App Open

xGrowth SDK also gives the option to load and show the App Open ad format (Google Ad Manager / AdMob). Implementation is similar to the document: https://developers.google.com/admob/android/app-open. Instead of creating a new AppOpenAdManager mentioned there, use the xGrowth SDK methods below and follow the Activity/Application implementation from the Google document. xGrowth SDK provides methods to load and show App Open ads.

Create your AdRequestConfiguration as shown:

AdRequestConfiguration (Java)
AdRequestConfiguration.Builder configuration = AdRequestConfiguration.Companion.builder(context, "Your_placement_name");
1

Load App Open Ad

Call loadAd() using the xGrowth AdLoader builder and provide listeners to receive load and ad events.

Load App Open Ad (Java)
AdSterAdLoader.Companion.builder().withAdsListener(new MediationAdListener() {
    @Override
    public void onFailure(@NonNull AdError adError) {
        // Handle failure callback here
    }

    @Override
    public void onAppOpenAdLoaded(@NonNull MediationAppOpenAd ad) {
        super.onAppOpenAdLoaded(ad);
        // Show App Open Ad here
    }
}).withAppOpenAdEventsListener(new AppOpenAdEventsListener() {
    @Override
    public void onAdClicked() {
        // Callback when ad is clicked
    }

    @Override
    public void onAdImpression() {
        // Callback when ad is shown
    }

    @Override
    public void onAdOpened() {
        // Callback when ad is opened
    }

    @Override
    public void onAdClosed() {
        // Callback when ad is closed
    }

    @Override
    public void onFailure(@Nullable AdError adError) {
        // Callback when there is failure
    }

    @Override
    public void onAdRevenuePaid(double revenue, @NotNull String adUnitId, @NotNull String network) {
        // Callback which provides revenue and the network which provided it
    }
}).build().loadAd(configuration.build());
2

Show App Open Ad

Inside the onAppOpenAdLoaded callback, invoke showAd(activity) on the MediationAppOpenAd instance to display the App Open ad above any activity.

Show App Open Ad (Java)
@Override
public void onAppOpenAdLoaded(@NonNull MediationAppOpenAd ad) {
    super.onAppOpenAdLoaded(ad);
    ad.showAd(activity);
}

Links:

  • Google App Open guide: https://developers.google.com/admob/android/app-open

Last updated