Can you serve both advertisements and interstitials?

Can you serve both banner ads and interstitials in the same activity? Is this against AdMob's policy?

For example, when you open an app, an ad appears, and when you close an app, a banner ad appears, or when a banner is already displayed, you serve an ad.

+3


source to share


2 answers


Yes, you can.

Take a look at the documentation for more information https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals

Also you can use "AdListener" very useful for your own purposes!



adView.setAdListener(new AdListener() {
            @Override
            public void onAdClosed() {
                //Called when the user is about to return to the application after 
                super.onAdClosed();
            }

            @Override
            public void onAdFailedToLoad(int errorCode) {
                //Called when an ad request failed
                super.onAdFailedToLoad(errorCode);
            }

            @Override
            public void onAdLeftApplication() {
                //Called when an ad leaves the application (e.g., to go to the browser)
                super.onAdLeftApplication();
            }

            @Override
            public void onAdOpened() {
                //Called when an ad is received
                super.onAdOpened();
            }

            @Override
            public void onAdLoaded() {
                //Called when an ad opens an overlay that covers the screen
                super.onAdLoaded();
            }
        });

      

You can fill each method with your own code :)

+1


source


Of course, you can display both a banner ad and an interstitial ad in your application. Here you go.



MainActivity.java add below lines of code in onCreate metho

0


source







All Articles