Interstitial Ad's Listener's Onadloaded() Won't Run
Solution 1:
Are you missing @override before onAdLoaded() method
Solution 2:
Hope you have added following in AndroidManifest.xml
Internet permission
<uses-permissionandroid:name="android.permission.INTERNET"/>
AdActivity
<activityandroid:name="com.google.android.gms.ads.AdActivity"android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
Google Play service lib under application tag
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
And added code as
interstitial = newInterstitialAd(this);
interstitial.setAdUnitId(getResources().getString(R.string.admob_inst));
// interstitial.setAdUnitId("01010101");// Create ad request.AdRequestadRequest=newAdRequest.Builder().build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
interstitial.setAdListener(newAdListener() {
@OverridepublicvoidonAdLoaded() {
// TODO Auto-generated method stubsuper.onAdLoaded();
interstitial.show();
}
});
Solution 3:
Do NOT call display() from #onAdLoaded. This will results is a very poor UX. Instead call display from a natural break point in your application (if an ad has been loaded).
Also these lines in your logs suggest that you also have banner ads.
05-1720:11:31.987: I/Ads(17509): Ad isnot visible. Not refreshing ad.
05-1720:11:31.992: I/Ads(17509): Scheduling ad refresh 60000 milliseconds from now.
If that is not the case then you have misconfigured your adUnit because you are getting auto refresh which does not happen for an interstitial. You need to explicitly load an interstitial each time.
Solution 4:
Use the following code to display the ad's listener on AdLoaded(). I used the same. It was worked for me.
protectedvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
interstitial = newInterstitialAd(this);
interstitial.setAdUnitId("***********");
AdRequest adRequest = newAdRequest.Builder().build();
interstitial.loadAd(adRequest);
interstitial.setAdListener(newAdListener() {
publicvoidonAdLoaded() {
displayInterstitial();
}
});
}
Outside oncreate function use below code:
publicvoiddisplayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
Post a Comment for "Interstitial Ad's Listener's Onadloaded() Won't Run"