App Open Ads
App open ads appear when users bring your app to the foreground, providing a monetization opportunity during app launches.
Each ad format uses a Zone ID to identify the ad placement. Zone IDs are configured in the Empower dashboard.
Note: All ad status listeners are optional. The SDK handles ad loading and display automatically. Use listeners only if you need to track ad states for analytics, UI updates, or custom logic.
Loading an App Open Ad
- Kotlin
- Java
import android.app.Applicationimport androidx.lifecycle.Lifecycleimport androidx.lifecycle.LifecycleObserverimport androidx.lifecycle.OnLifecycleEventimport androidx.lifecycle.ProcessLifecycleOwnerimport net.empower.mobile.ads.api.EMAManagerclass MyApplication : Application(), LifecycleObserver {private var currentActivity: Activity? = nulloverride fun onCreate() {super.onCreate()EMAManager.init(this, "YOUR_APP_AD_IDENTIFIER")ProcessLifecycleOwner.get().lifecycle.addObserver(this)// Preload the app open adEMAManager.loadAppOpenAd(zoneId = "YOUR_APP_OPEN_ZONE_ID")}@OnLifecycleEvent(Lifecycle.Event.ON_START)fun onMoveToForeground() {currentActivity?.let { activity ->EMAManager.showAppOpen(zoneId = "YOUR_APP_OPEN_ZONE_ID",activity = activity,onComplete = {// Reload for next timeEMAManager.loadAppOpenAd(zoneId = "YOUR_APP_OPEN_ZONE_ID")})}}// Track current activity using ActivityLifecycleCallbacksfun setCurrentActivity(activity: Activity?) {currentActivity = activity}}
Listening to App Open Status (Optional)
If you need to track app open ad status:
- Kotlin
- Java
EMAManager.loadAppOpenAd(zoneId = "YOUR_APP_OPEN_ZONE_ID",listener = object : AdStatusListener {override fun empowerAppOpenStatusChanged(adStatus: AdStatus) {when (adStatus) {AdStatus.READY -> { /* Ad is ready to be shown */ }AdStatus.FAILED -> { /* Ad failed to load */ }AdStatus.SHOWN -> { /* Ad is being displayed */ }else -> {}}}})
Best Practices
- Cold starts - Show on fresh app launches
- Exclude certain screens - Don't show on splash screens or purchase flows
- Time-based limits - Consider limiting frequency (e.g., once per session)
- Loading states - Ensure app content is ready before showing
Ad Status Reference
| Status | Description |
|---|---|
READY | Ad is loaded and ready to display |
FAILED | Ad failed to load |
SHOWN | Ad is being displayed |
SKIPPED | User dismissed the ad |