Initialization and Release
Before using any features of the SDK, you must initialize it in your OTT app's startup process. Set the operating environment mode to either local, dev, or prod as described below.
- local: This mode can be used in a local environment and the default log level is Verbose.
- dev: This mode can be used in a development environment and in this mode, the error log that is generated in the SDK is saved in the server. The default log level is Info.
- prod: This mode can be used in a commercial environment and in this mode, the error log that is generated in the SDK is saved in the server. The default log level Warn.
To ensure proper resource management and avoid potential memory leaks, always call the SDK release function when your OTT app terminates.
Java
public class YourApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// TODO GUIDE: initialize SDK
FlowerSdk.setEnv("local");
FlowerSdk.init(this);
}
@Override
public void onTerminate() {
super.onTerminate();
// TODO GUIDE: release SDK
FlowerSdk.destroy();
}
}
Kotlin
class YourApplication : Application() {
override fun onCreate() {
super.onCreate()
// TODO GUIDE: initialize SDK
FlowerSdk.setEnv("local")
FlowerSdk.init(this)
}
override fun onTerminate() {
super.onTerminate()
// TODO GUIDE: release SDK
FlowerSdk.destroy()
}
}
Deactivate Ad Skip Feature
If you are using an ad serving system other than Flower with the Flower SDK, ad skipping might malfunction. In such cases, you need to call the API to deactivate the FLOWER SDK's ad skip feature as follows.
Java
public class YourApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// ...
// TODO GUIDE: Disable ad skip function
FlowerSdk.ignoreSkip();
}
}
Kotlin
class YourApplication : Application() {
override fun onCreate() {
super.onCreate()
// ...
// TODO GUIDE: Disable ad skip function
FlowerSdk.ignoreSkip()
}
}