want to show admob interstitial on app start

admob interstitial ads policy
admob interstitial on back button
interstitial ads timer
admob interstitial ad unit id
layout encourages accidental clicks - unexpected launch interstitials
onadclosed admob
admob error_code_internal_error
banner and interstitial ads

I integrate the interstitial ad from admob in my application and that is of google play version. I want to show ad on starting of app but it does not work. I have a code in which ad comes up on "onPause", "onResume" etc methods. Is there any way to show ad on starting of app like within 2 second of starting an app. Here is my code for interstitial.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    StartAppAd.init(this, "110342272", "204516610");

    setContentView(R.layout.activity_start);

    // Create the interstitial.
    interstitial = new InterstitialAd(this);
    interstitial.setAdUnitId("ca-app-pub-2869508995487312/2690564381");

    // Create ad request.
    AdRequest adRequest = new AdRequest.Builder().build();

    // Begin loading your interstitial.
    interstitial.loadAd(adRequest);
           }
    @Override
protected void onPause() {
display();
super.onStart();
}

public void display() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}

Here's what I created to load interstitial ad when user open the app:

      InterstitialAd interstitial;

private static final String AD_UNIT_ID = "YOUR_AD_UNIT_ID";
private InterstitialAd interstitialAd;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_start);


    interstitialAd = new InterstitialAd(this);

    interstitialAd.setAdUnitId(AD_UNIT_ID);
    AdRequest adRequest = new AdRequest.Builder().build();

    interstitialAd.loadAd(adRequest);

    interstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {

                if (interstitialAd.isLoaded()) {
                    interstitialAd.show();
                }

        }

        @Override
        public void onAdOpened() {


        }

        @Override
        public void onAdFailedToLoad(int errorCode) {

        }
    });

}

Interstitial Ads | Android, When an app shows an interstitial ad, the user has the choice to course of an activity's lifespan, so you only need to construct it once. The easiest way to load test ads is to use our dedicated test ad unit ID for Android interstitials If you haven't already, create your own interstitial ad unit in the AdMob UI. You can show Interstitial after app load, with such practice you have to implement a splash screen in your app and show interstitial after it. An interstitial ad launches while the user is idle on the ‘Home Screen’ of the app.

According to new policies of Admob , interstitial ads are not permitted on start and exiting of app.Your account may be banned if you will violate this policy. Therefore avoid it. Please click on the following link to read the admob policy for more clarification. https://support.google.com/admob/answer/6201362?hl=en

Interstitial Ads | iOS, This guide shows you how to integrate interstitial ads into an iOS app. To load an interstitial ad, call loadRequest: on a GADRequest object: To request another interstitial, you'll need to create a new GADInterstitial object. If you haven't already, create your own interstitial ad unit in the AdMob UI. Show the ad. Interstitial ads should be displayed during natural pauses in the flow of an app. Between levels of a game is a good example, or after the user completes a task. To show an interstitial, use the isLoaded() method to verify that it's done loading, then call show().

According to https://support.google.com/admob/answer/6201362?hl=en you can show ads on app start as long as you've loaded the app before showing it.

insert this member variable private val doOnce = true

doOnce will ensure that your Ad is shown only once when the ad is Loaded, since onAdLoaded is a callback failure to do this will cause incessant spam ad popups.

mInterstitialAd?.adListener = object : AdListener() {
   override fun onAdClosed() {
      requestNewInterstitial()
   }

   override fun onAdLoaded() {
      super.onAdLoaded()
      if (doneOnce) {
         mInterstitialAd?.show()
         doneOnce = false
       }
   }
}

Save and retrieve it across configuration change

override fun onSaveInstanceState(outState: Bundle?, outPersistentState: PersistableBundle?) {
   super.onSaveInstanceState(outState, outPersistentState)
   outState?.putBoolean(DO_ONCE_KEY, doOnce)
}

override fun onRestoreInstanceState(savedInstanceState: Bundle?) {
   super.onRestoreInstanceState(savedInstanceState)
   if (savedInstanceState != null){
       doOnce = savedInstanceState.getBoolean(DO_ONCE_KEY)
   }
}

Disallowed interstitial implementations - AdMob Help, Do not place interstitial ads on app load and when exiting apps as interstitials Placing interstitial ads so that they suddenly appear when a user is focused on a​  Now, you can start to add a banner and/or an interstitial ad to your project. Important Note 1: If this step cannot be implemented properly, you are going to get “ The Google Mobile Ads SDK was

Android Integrate AdMob Interstitial Ads in App, We can monetize the android app by displaying the admob interstitial ads. To show interstitial ads first, we need to check whether the ad loaded or not using To start integrating AdMob ads in our android application, we need to import the  Use those ad units to test your Apps before publishing them on any store. If they work, then change them to the real ones you created on Admob before publishing. Note: When testing your Apps don't use your original As units.

Adding banner and interstitial ads to your Android app, By adding these ads to your app, you show some advertisements in your app You need to sign up for an AdMob account first in order to advertise. Now, you can start to add a banner and/or an interstitial ad to your project. In this video we are going to learn about how to place an AdMob interstitial Ad in your android App. The interstitial ad cover the entire app. Place the interstitial ad in between levels of a game

Android, Interstitial ads are full-screen ads that cover the whole UI of the app. This article shows you how to integrate Interstitial ads from AdMob into an Android app. Interstitial Ad load Request. interstitial.loadAd(adIRequest);. // Prepare an App using Android Studio · 10 Important Android Studio Shortcuts You Need the Most​  One way of doing this is by using 'Handler'. You can use them to show ads after 5 seconds and then again after 4 minutes by putting the code in onCreate method of your activity. But, I would not recommend you to do this as this isn't a good practice. Feel free to message me if you have any query.

Comments
  • Superb! it works like charm. :) thank you very much!
  • Yes this helped me out. Nice solution.
  • Very important tip for new comers, as this question is the first that pops up when you google it