How to get test ad Banners and test Interstitial ads working for adMob?

孤者浪人 提交于 2019-12-01 23:00:48

OK, several problems here.

1) No you are not using the AdListener interface correctly. Don't create your own interface. AdMob already supplies an AdListener interface. You do need to implement it however.

NB personally I would create an anonymous implementation of the AdListener instead of adding it to the Activity, but that's a design design for yourself.

Next you need to attach your listener to your AdView. So in your #onCreate

// load banner ads
adView.setAdListener(new AdListener() {
   ...
});
adView.loadAd(adRequestBanner);

2) You are unlikely to see any Interstitials with the code above because you are attempting to display immediately after requesting. It is extremely unlikely that an Interstitial has been downloaded in that short time frame. And in any case you really don't want to display an interstitial every time your Activity is created, it is a poor user experience.

Move your call to displayInterstitial() to some later point in your app life cycle, such at the end of a game session or between levels etc.

m.drz

Last I looked at admob the interstitial ads were invite only. Meaning they would contact you if they felt your apps were a good fit with that type of advertising.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!