问题
I have a problem with Ionic 3 when trying to display ads with Admob Free plugin. My Ads will only show in test mode (isTesting: true). If I set it to false or comment the line, no Ads ...
This is my code:
showBannerAd(){
const bannerConfig: AdMobFreeBannerConfig = {
id:'BANNER-ID',
autoShow: true,
isTesting: false
}
this.adMob.banner.config(bannerConfig);
this.adMob.banner.prepare().then(()=>{
//this.adMob.banner.show();
}).catch(err => console.log(err));
}
If I uncomment the line this.adMob.banner.show() to force the ads, only a black unit appears.
I thought it could be related to my project, so I even started a blank project and the results were the same.
Has anyone fixed before? Thanks!!!
回答1:
Finally I solved this issue!
Since my code seemed to be right, as the test Ads were working, I went back to my Admob account and found out that I had missing payment info.
As soon as I added my address on the payment page, my live Ads started being served.
I have tested my app on Android (emulator and device) and IOS (emulator only) and the Live Ads are being served with no problem on both.
App with loaded Ads
回答2:
Bro sorry for not helping you but from 3 days a go i don't know why my ionic doesn't work after installing admob-free this is the error i got while building app :
Dex: Error converting bytecode to dex: Cause: PARSE ERROR: class name (com/google/android/gms/base/R) does not match path (Com/google/android/gms/base/R.class) ...while parsing Com/google/android/gms/base/R.class
回答3:
I have faced this issue and some of the mistakes i did was:
1) I had placed my App-Id as my Ad-Id. You will get the correct Ad-Id when you create an ad instance in Admob
2) I had placed all my ad-configuration in the controller of my component, and what you are supposed to do is to place it in a ionViewDidLoad() method.
来源:https://stackoverflow.com/questions/48797581/ionic-3-admob-free-not-displaying-ads-when-testing-is-false