Documentation

Unity Ads Monetization


Android API reference

Unity Ads Monetization


Implement interstitial ads in Android

Implement interstitial ads in your Android app. Load ad content, display it through Java code, and use a listener to manage ad events.
Read time 1 minuteLast updated a day ago

Interstitial ad load example

Use
LoadConfiguration.Builder
to construct a load request with the placement ID and mediation metadata, optionally including ad markup for bidding. Pass the built configuration to
InterstitialAd.load()
along with a
LoadListener
. The
onAdLoaded
callback receives the loaded
InterstitialAd
instance on success, or a
UnityAdsError
on failure. Retain the ad instance, as it's required to show the ad later.
InterstitialAd.load(loadConfig, (interstitialAd, error) -> {if (interstitialAd != null) { // Ad loaded successfully, ready to be shown this.interstitialAd = interstitialAd; } else { // Handle load error }});

Interstitial ad show example

Call
show()
on the retained
InterstitialAd
instance, passing the activity, a
ShowConfiguration
, and an
InterstitialShowListener
. The listener provides callbacks for each stage of the ad's lifecycle:
onStarted
when the ad displays,
onClicked
when the user interacts with it,
onCompleted
when it closes, and
onFailed
if an error occurs — with the error details available via the
UnityAdsError
argument.
loadedInterstitialAd.show(activity, new ShowConfiguration.Builder().build(), new InterstitialShowListener(){ @Override public void onStarted(@NonNull InterstitialAd ad) { /* displayed */ } @Override public void onClicked(@NonNull InterstitialAd ad) { /* clicked */ } @Override public void onCompleted(@NonNull InterstitialAd ad, @NonNull ShowFinishState state) { /* hidden */ } @Override public void onFailed(@NonNull InterstitialAd ad, @NonNull UnityAdsError error) { /* failed */ }} );
Next steps: To improve your implementation, refer to the Implement rewarded ads in Android documentation.