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-permission android:name="android.permission.INTERNET"/>
AdActivity
<activity android: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 = new InterstitialAd(this);
interstitial.setAdUnitId(getResources().getString(R.string.admob_inst));
// interstitial.setAdUnitId("01010101");
// Create ad request.
AdRequest adRequest = new AdRequest.Builder().build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest);
interstitial.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
// TODO Auto-generated method stub
super.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-17 20:11:31.987: I/Ads(17509): Ad is not visible. Not refreshing ad.
05-17 20: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.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("***********");
AdRequest adRequest = new AdRequest.Builder().build();
interstitial.loadAd(adRequest);
interstitial.setAdListener(new AdListener() {
public void onAdLoaded() {
displayInterstitial();
}
});
}
Outside oncreate function use below code:
public void displayInterstitial() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
Post a Comment for "Interstitial Ad's Listener's OnAdLoaded() Won't Run"