Configuration
This guide explains how to initialize and configure the Empower Mobile Ads SDK in your application.
SDK Initialization
Initialize the SDK after the consent flow completes, ideally from the consent callback. See Terms and Privacy Policy Flow.
Basic Initialization
- Kotlin
- Java
EMAManager.init(
application = this,
appAdIdentifier = "YOUR_APP_AD_IDENTIFIER"
)
EMAManager.INSTANCE.init(this, "YOUR_APP_AD_IDENTIFIER");
Replace YOUR_APP_AD_IDENTIFIER with the app identifier provided by Empower.
Advanced Initialization with Configuration
For more control over the SDK behavior, use the EMAConfiguration builder:
- Kotlin
- Java
val configuration = EMAConfiguration.Builder(
application = this,
appAdIdentifier = "YOUR_APP_AD_IDENTIFIER"
)
.debugMode(true)
.logLevel(LogLevel.DEFAULT)
.build()
EMAManager.init(configuration)
EMAConfiguration configuration = new EMAConfiguration.Builder(
getApplication(),
"YOUR_APP_AD_IDENTIFIER"
)
.debugMode(true)
.logLevel(LogLevel.DEFAULT)
.build();
EMAManager.INSTANCE.init(configuration);
When sharing a test APK with us for verification, build it with .debugMode(true) and .logLevel(LogLevel.ALL) so we can inspect the SDK logs. Keep both disabled in production builds.
Log Levels
| Level | Description |
|---|---|
ALL | Logs all messages including debug information |
DEFAULT | Logs general information and errors |
ERROR | Logs errors only |
WARNING | Logs warnings and errors only |
NONE | Disables all logging |
Listening for SDK Ready State
If you need to know exactly when the SDK is ready (for analytics, UI updates, etc.), implement EMASdkReadyListener. Call setSdkReadyListener before init so the ready event is not missed:
- Kotlin
- Java
class MyApplication : Application(), EMASdkReadyListener {
override fun onCreate() {
super.onCreate()
EMAManager.setSdkReadyListener(this)
EMAManager.init(this, "YOUR_APP_AD_IDENTIFIER")
}
override fun onReady() {
}
override fun onFailed(error: Throwable?) {
}
}
public class MyApplication extends Application implements EMASdkReadyListener {
@Override
public void onCreate() {
super.onCreate();
EMAManager.INSTANCE.setSdkReadyListener(this);
EMAManager.INSTANCE.init(this, "YOUR_APP_AD_IDENTIFIER");
}
@Override
public void onReady() {
}
@Override
public void onFailed(@Nullable Throwable error) {
}
}
Ad load calls made right after init() are queued and run automatically once the SDK is ready. Use the listener only if you need the exact ready moment, for example for analytics or UI updates.
Disabling Ads at Runtime
If you need to temporarily stop serving ads without tearing down the SDK (e.g., a feature flag or a user toggle), set EMASettings.isAdsDisabled to true. The SDK stays initialized, so flipping it back to false resumes ads immediately. No re-initialization required.
- Kotlin
- Java
// Stop serving ads without shutting down the SDK
EMASettings.isAdsDisabled = true
// Resume ads later
EMASettings.isAdsDisabled = false
// Stop serving ads without shutting down the SDK
EMASettings.INSTANCE.setAdsDisabled(true);
// Resume ads later
EMASettings.INSTANCE.setAdsDisabled(false);
Use this for short-lived toggles. For permanent shutdown (e.g., user purchased premium and you want to release all SDK resources), use shutdown() below.
Shutdown
Use shutdown() when you no longer want to show ads (e.g., user bought premium):
- Kotlin
- Java
EMAManager.shutdown()
EMAManager.INSTANCE.shutdown();