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

import android.app.Application
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import androidx.lifecycle.ProcessLifecycleOwner
import net.empower.mobile.ads.api.EMAManager
class MyApplication : Application(), LifecycleObserver {
private var currentActivity: Activity? = null
override fun onCreate() {
super.onCreate()
EMAManager.init(this, "YOUR_APP_AD_IDENTIFIER")
ProcessLifecycleOwner.get().lifecycle.addObserver(this)
// Preload the app open ad
EMAManager.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 time
EMAManager.loadAppOpenAd(zoneId = "YOUR_APP_OPEN_ZONE_ID")
}
)
}
}
// Track current activity using ActivityLifecycleCallbacks
fun setCurrentActivity(activity: Activity?) {
currentActivity = activity
}
}

Listening to App Open Status (Optional)

If you need to track app open ad status:

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

StatusDescription
READYAd is loaded and ready to display
FAILEDAd failed to load
SHOWNAd is being displayed
SKIPPEDUser dismissed the ad