Configuration

This guide explains how to initialize and configure the Empower Mobile Ads SDK in your application.

User Consent (UMP)

The SDK ships a built-in Google UMP integration. Call EMAManager.requestConsent(activity) on your launch activity, then call EMAManager.init(...) from its callback. The helper shows the consent form when required (GDPR regions) and skips it everywhere else. The callback always fires, even on UMP errors, so you can chain init(...) from it unconditionally.

EMAManager.requestConsent(this) {
EMAManager.init(
EMAConfiguration.Builder(application, "YOUR_APP_AD_IDENTIFIER").build()
)
}

Once consent is resolved, the SDK handles it automatically. You don't need to bridge consent to any ad network yourself.

Privacy Settings button

Users in regulated regions must be able to change their consent later. Add a button in your settings screen that calls showPrivacyOptionsForm(), and only show it when isPrivacyOptionsRequired() returns true:

if (EMAManager.isPrivacyOptionsRequired(context)) {
privacySettingsButton.isVisible = true
privacySettingsButton.setOnClickListener {
EMAManager.showPrivacyOptionsForm(this)
}
}

:::note If your app already runs Google UMP or another IAB-compliant CMP, skip EMAManager.requestConsent() and just call EMAManager.init(...) from your own consent callback. The SDK will read automatically. In that case also use your CMP's own privacy options entry point instead of showPrivacyOptionsForm(). :::

SDK Initialization

Initialize the SDK after consent is obtained. The recommended approach is in your launch activity's consent callback.

Basic Initialization

EMAManager.init(
application = this,
appAdIdentifier = "YOUR_APP_AD_IDENTIFIER"
)

:::caution Important 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:

val configuration = EMAConfiguration.Builder(
application = this,
appAdIdentifier = "YOUR_APP_AD_IDENTIFIER"
)
.debugMode(BuildConfig.DEBUG)
.logLevel(LogLevel.DEFAULT)
.build()
EMAManager.init(configuration)

Configuration Options

OptionTypeDefaultDescription
debugModeBooleanfalseEnables verbose logging for debugging. Disable in production.
logLevelLogLevelNONEControls the verbosity of SDK logs.
nonPersonalizedAdsBooleanfalseWhen true, serves only non-personalized ads (GDPR compliance).

Log Levels

LevelDescription
ALLLogs all messages including debug information
DEFAULTLogs general information and errors
ERRORLogs errors only
WARNINGLogs warnings and errors only
NONEDisables all logging

Register Your Application Class

If you initialize the SDK in an Application class, ensure it is registered in AndroidManifest.xml:

<manifest>
<application
android:name=".MyApplication"
...>
</application>
</manifest>

Automatic Ad Queueing

All ad types (banner, interstitial, rewarded, app open) automatically queue if called before SDK initialization completes. You can safely load ads immediately after calling init():

EMAManager.init(this, "YOUR_APP_AD_IDENTIFIER")
// These calls are safe immediately after init()
// They will queue and execute once SDK is ready
EMAManager.loadInterstitialAd("interstitial_zone_id")
EMAManager.loadRewardedAd("rewarded_zone_id")
EMAManager.loadAppOpenAd("app_open_zone_id")

Impression Level Ad Revenue (ILRD) Integration

The SDK reports the estimated revenue of every paid ad impression, regardless of which ad network served it, through a single callback. Works for all ad formats: banner, interstitial, rewarded, and app open.

Usage

Register one global listener in your Application class so no impression is missed. It can be set before or after EMAManager.init. Only one listener can be registered, and setting a new one replaces the previous one. Pass null to remove it.

import net.empower.mobile.ads.api.EMAManager
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
EMAManager.setAdRevenueListener { revenue ->
// Called on the main thread, once per paid impression
}
}
}

The EMAAdRevenue Object

Each impression delivers an EMAAdRevenue object:

FieldTypeDescription
adFormatEMAAdFormatBANNER, INTERSTITIAL, REWARDED, or APP_OPEN
zoneIdStringThe zone ID the ad was loaded for
providerEMAAdProviderThe ad platform that served the impression
adUnitIdStringThe ad unit that served the impression
valueDoubleRevenue for this impression, in whole currency units
valueMicrosLongThe same revenue in micro-units (1,000,000 = 1 unit)
currencyCodeStringISO-4217 currency code of the value (not always USD)
eventTimeMillisLongWhen the event was received, in epoch milliseconds

Note: Values are per-impression estimates provided by the ad platforms. Totals will not match your dashboard reports exactly.

Listening for SDK Ready State (Optional)

If you need to know exactly when the SDK is ready (for analytics, UI updates, etc.), implement EMASdkReadyListener:

class MyApplication : Application(), EMASdkReadyListener {
override fun onCreate() {
super.onCreate()
EMAManager.setSdkReadyListener(this)
EMAManager.init(this, "YOUR_APP_AD_IDENTIFIER")
}
override fun onReady() {
// SDK is initialized and ready to load ads
}
override fun onFailed(error: Throwable?) {
// SDK initialization failed
}
}

:::note This listener is optional. Since all ad types automatically queue, you don't need to wait for onReady() before loading ads. :::

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.

// Stop serving ads without shutting down the SDK
EMASettings.isAdsDisabled = true
// Resume ads later
EMASettings.isAdsDisabled = false

:::tip 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):

// Stop all ads
EMAManager.shutdown()
// Reinitialize when you want to show ads again
EMAManager.init(application, "YOUR_APP_AD_IDENTIFIER")