I followed the official guide of Android to add interstitial ads.
If I use test mode:
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("my code here")
.build();
mInterstitialAd.loadAd(adRequest);
Works ok and I can see the demo interstitial add.
If I use release mode:
AdRequest adRequest = new AdRequest.Builder().build();
mInterstitialAd.loadAd(adRequest);
I only see black interstitial add and in log in red:
JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (:1)
+ Info:
- I use last updated google play services lib.
- I try with 2 devices and 2 wifi networks.
- In the same device I can see other apps interstitial ads
- The ad was created in adMob in last 24 hours.
- I try to load add fron thread but app crash
- My adMob account is ok, I have other ads working.
Manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
(...)
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
Activity OnCreate:
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId("here my add id");
mInterstitialAd.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
requestNewInterstitial();
}
});
requestNewInterstitial();
In app natural break:
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
The problem has been solved just waiting 22 hours since the creation of ad in AdMob.
Does webview in your activity? Please comment code:
And It works.