Home > database >  Real Admob Interstitial Ads Not Displaying During Testing of Android App
Real Admob Interstitial Ads Not Displaying During Testing of Android App

Time:01-04

This is my first app, and it is all complete except for the ads. For clarification:

  • I was able to get the test Interstitial ads to show up correctly, so test ads work perfectly
  • I just added the payment information to my account a few hours ago
  • I have received an email from Admob with my official App ID # and Ad Unit Id #
  • I have browsed around the forums and have read it may take a few hours of a few days for real ads to show

My first question is what number should I put in the the Manifest file for real ads? From the documentation for testing:

Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713<manifest>
    <application>
        <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
    </application>
</manifest>

To show a real ads, I'm confused about what to input for the value:

android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy

Example for the the xxxxxs - I have an App ID # and an Ad Unit Id#, but neither are long enough. There 16 x placeholders for the numbers. From an email from Admob:

Let's say my App ID # is: 1234567890

And Let's say my Ad Unit ID # is: 9876543210

Both are 10 digits, not 16 so I figure they are not a match. When I go to my Admob account and look at Ad settings for the Interstitial ad I setup I see the following:

Ad Unit ID: ca-app-pub-7777777777777777/5555555555

Question - should I place that ad unit ID in my Manifest for real ads? I also don't understand why the 2nd half of the Ad Unit ID differs from one that Admob emailed me.

5555555555 != 9876543210

And then in my MainActivity I had the test ad code:

InterstitialAd.load(this,"ca-app-pub-3940256099942544/1033173712", adRequest,

As best as I can surmise is that for real ads I should replace the first portion:

3940256099942544

Which is for testing with the code from Ad Unit ID # from Admob settings:

7777777777777777

And then after the forward slash replace the 1033173712 with the Ad Unit ID from the Admob email:

9876543210

I think I need to get a real ad to display in testing before I upload the app to the Play Store for review. I'm just really confused as which ID # to use and where. I can wait for the account to to be approved to show ads - but I don't know if the ID #s are incorrect and that is reason why real ads don't show. Any assistance would be really appreciated - this is the last step after 13 months of hard work! Thanks.

CodePudding user response:

Use the App Id that you received (can be found on your AdMob dashboard also) in your AndroidManifest.xml instead of ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy.

Replace the "ca-app-pub-3940256099942544/1033173712" with your Ad Unit Id when loading Ads.

Note:

  1. App Id contains a ~ (tilde) in it.
  2. Ad Unit Id contain a / (forward slash).
  •  Tags:  
  • Related