Closed steoo closed 6 years ago
I am also experiencing the same issue, also if I show interstitial ads in production build they show test ads. But there is a workaround if I load the same page again For Example in another tab if my app is having tabs and load admob again, the ads start working just fine.
Is there a way I could "refresh" the page so the ads loads?
On Jul 5, 2017 20:10, "AnuroopGambhir" notifications@github.com wrote:
I am also experiencing the same issue, also if I show interstitial ads in production build they show test ads. But there is a workaround if I load the same page again For Example in another tab if my app is having tabs and load admob again, the ads start working just fine.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ratson/cordova-plugin-admob-free/issues/83#issuecomment-313182594, or mute the thread https://github.com/notifications/unsubscribe-auth/ADLdxX-f-StVaE46STmlf9aRGLtIStvyks5sK9GtgaJpZM4OOVmj .
I don't know any way to do so, actually, i started to work on ionic for like a month ago. Before this, I used to work on native development with the Android studio. Even I am finding a workaround for this problem. I have not slept for like 24 hrs trying to solve this problem searched the whole internet and no results so far, I accidentally got the workaround I discussed above, but it is also not sufficient. I tried to use AdmobPro also but it makes my app unresponsive. https://play.google.com/store/apps/details?id=com.admireapps.petrolprices&hl=en This the link to my app I made a few days ago and it suffers from the same problem, the banner ad is not shown at startup but if i return from another page it is shown.
The weird thing is that it happens only in production mode, at least in my case. I guess we may try to force page navigation forward and backward. I hope there's an API to navigate through pages.
On Jul 5, 2017 20:22, "AnuroopGambhir" notifications@github.com wrote:
I don't know any way to do so, actually, i started to work on ionic for like a month ago. Before this, I used to work on native development with the Android studio. Even I am finding a workaround for this problem. I have not slept for like 24 hrs trying to solve this problem searched the whole internet and no results so far, I accidentally got the workaround I discussed above, but it is also not sufficient. I tried to use AdmobPro also but it makes my app unresponsive. https://play.google.com/store/apps/details?id=com. admireapps.petrolprices&hl=en This the link to my app I made a few days ago and it suffers from the same problem, the banner ad is not shown at startup but if i return from another page it is shown.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ratson/cordova-plugin-admob-free/issues/83#issuecomment-313185666, or mute the thread https://github.com/notifications/unsubscribe-auth/ADLdxcoyyOMSEcuqRWJdSwGiV9vhu-mXks5sK9R4gaJpZM4OOVmj .
Same happens in my case too, only production mode is having this bug, debug mode works just fine.
@steoo As your case is to show the banner immediately after it's being prepared why don't you use the autoShow: true
in the AdMobFreeBannerConfig
? The code you have provided:
this.admob.banner.prepare().then(() => {
this.admob.banner.show();
})
I'm not really sure that promise will be resolved when the ad is really prepared - instead it resolves just after the internal admob call has finished.
I'll try but what is this promise provided for so?
On Jul 5, 2017 20:33, "Kamil Rykowski" notifications@github.com wrote:
@steoo https://github.com/steoo As your case is to show the banner immediately after it's being prepared why don't you use the autoShow: true in the AdMobFreeBannerConfig? The code you have provided:
this.admob.banner.prepare().then(() => { this.admob.banner.show(); })
I'm not really sure that promise will be resolved when the ad is really prepared - instead it resolves just after the internal admob call has finished.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ratson/cordova-plugin-admob-free/issues/83#issuecomment-313188424, or mute the thread https://github.com/notifications/unsubscribe-auth/ADLdxQVk5kMT6Vwc2uD43jVFcA2oUa66ks5sK9bhgaJpZM4OOVmj .
I have tried that too, many of the times it shows nothing. And there is already an open issue with the same topic. https://github.com/ratson/cordova-plugin-admob-free/issues/74
i did have this issue, the problem was how the config was set for banner or interstitial ads. Now is working.
This is my AdMob free services:
import { Injectable } from '@angular/core'; import { AdMobFree, AdMobFreeBannerConfig, AdMobFreeInterstitialConfig } from '@ionic-native/admob-free';
interface AdMobType { banner: string, interstitial: string }
@Injectable() export class AdMobService { admobid: AdMobType; private bannerPrepared: boolean = false; private interstitialPrepared: boolean = false;
constructor(private adMob: AdMobFree) {
if (/(android)/i.test(navigator.userAgent)) {
this.admobid = {
banner: 'ca-app-pub-xxx/xxx',
interstitial: 'ca-app-pub-xxx/xxx'
};
} else if (/(ipod|iphone|ipad)/i.test(navigator.userAgent)) {
this.admobid = {
banner: 'ca-app-pub-xxx/xxx',
interstitial: 'ca-app-pub-xxx/xxx'
};
} else {
this.admobid = {
banner: 'ca-app-pub-xxx/xxx',
interstitial: 'ca-app-pub-xxx/xxx'
};
}
}
prepareBanner() {
const bannerConfig: AdMobFreeBannerConfig = {
id: this.admobid.banner,
size: 'SMART_BANNER',
autoShow: true,
isTesting: false,
bannerAtTop: false,
overlap: false,
offsetTopBar: false
}
this.adMob.banner.config(bannerConfig);
this.adMob.banner.prepare().then(() => {
this.bannerPrepared = true;
}).catch((err) => {
throw new Error(err);
});
}
showBanner() {
if (this.bannerPrepared) {
this.adMob.banner.show().then(() => {
this.bannerPrepared = false;
}).catch((err) => {
throw new Error(err);
});
}
}
hideBanner() {
this.adMob.banner.hide().then(() => {
this.bannerPrepared = true;
}).catch((err) => {
throw new Error(err);
});
}
removeBanner() {
this.adMob.banner.remove().then(() => {
this.bannerPrepared = false;
}).catch((err) => {
throw new Error(err);
});
}
prepareInterstitial() {
const interstitialConfig: AdMobFreeInterstitialConfig = {
id: this.admobid.interstitial,
isTesting: false,
autoShow: false
};
this.adMob.interstitial.config(interstitialConfig);
this.adMob.interstitial.prepare().then(() => {
this.interstitialPrepared = true;
}).catch((err) => {
throw new Error(err);
})
}
showInterstitial() {
if(this.interstitialPrepared) {
this.adMob.interstitial.show().then(() => {
this.interstitialPrepared = false;
}).catch((err) => {
throw new Error(err);
});
}
}
}
How showBanner
is supposed to be called? Is it listening to some events?
@caciobanita Thanks, man you are a life saver, interstitial ads working fine now. But reward video ads not working yet. @steoo You are supposed to call the method showbanner() and showinterstitial() when needed. For banner best place would be the constructor of the page.
What is the point of calling show()
if autoShow
is set to true
?
well, in that case, you don't need to call, but in the example given be @caciobanita he didn;t set autoShow to true .
Hello, Everyone, I found very simple solution for this :)
Just use the banner add in your root component i.e app.component.ts ( Remove banner ad from other pages of your app )
this.platform.ready().then(() => { // Here you have to set banner ads :) this.showBanAd(); this.splashScreen.hide(); }); I recommend all the ionic developers to checkout this course. This course has all the scenarios covered regarding ionic AdMob: https://www.udemy.com/admob-ionic/ Other ads like interstitial can be in other components as per your app.
@rapiddevpro thanks, it works for me :)
@rapiddevpro It worked for me too, it's a shame, I had to remove the intersticial
It's in my home.ts component. The app has 2 pages with a side menu. In my android-debug.apk version of the app, when I start the app the banner is immediatly shown.
In the production release, when I first start the app no ads is shown. If I change page and return back to the first page, the ads are shown.
Any clue?
This is the code I'm running for showing the ads.