-1
I have a problem with showing ads like video admob free, I have other types of advertising and it works 100%. I know you have some more current versions of admob free, but I would like to resolve it without having to update it, as it impacts other things. The most curious thing about my code is that instead of opening the video ad opens the ad of the intercistial type, that when I put the id = ', if I put the ad id I created in admob, it from the error rewardVideoLoadFail, enters this event.
I use Cordova-android 6.2.3 and on the summer of the plugin:
"@ionic-native/admob-free": "^4.5.0",
"cordova-admob-sdk": "^0.8.0",
"cordova-android": "6.2.3",
"cordova-plugin-admob-free": "^0.10.0",
My Method to Open the Video Ad:
showRewardVideo(rewardFn?): Promise<boolean> {
const rewardVideoConfig: AdMobFreeRewardVideoConfig = {
id: '', //test
isTesting: true,
autoShow: true
}
let loadingContent: string;
loadingContent = 'Carregando Vídeo';
const loading = this.loadingCtrl.create({
spinner: 'bubbles',
content: loadingContent
});
loading.present();
this.admobFree.rewardVideo.config(rewardVideoConfig);
return new Promise<boolean>((resolve) => {
rewardVideoClose = this.admobFree.on(this.admobFree.events.REWARD_VIDEO_CLOSE).subscribe(() => {
rewardVideoLoad.unsubscribe();
rewardVideoLoadFail.unsubscribe();
rewardVideoClose.unsubscribe();
rewardVideoReward.unsubscribe();
});
rewardVideoLoad = this.admobFree.on(this.admobFree.events.REWARD_VIDEO_LOAD).subscribe(() => {
this.admobFree.rewardVideo.show()
.then(() => {
loading.dismiss();
resolve(true);
})
.catch(() => {
loading.dismiss();
resolve(false);
});
});
rewardVideoLoadFail = this.admobFree.on(this.admobFree.events.REWARD_VIDEO_LOAD_FAIL).subscribe((value) => {
console.log('rewardVideoLoadFail', value);
loading.dismiss();
resolve(false);
});
rewardVideoReward = this.admobFree.on(this.admobFree.events.REWARD_VIDEO_REWARD).subscribe(() => {
rewardFn();
rewardVideoReward.unsubscribe();
});
this.admobFree.rewardVideo.prepare()
.then(() => { })
.catch(() => {
loading.dismiss();
resolve(false);
});
});
}