ADMOB free Advertising award-winning video does not work

Asked

Viewed 202 times

-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);
      });
  });
}

1 answer

1


After a lot of tests and a lot of searching for this problem, I was able to solve it. Using the type of award-winning video ad as a test doesn’t always have a video to be shown by admob, I know that in other versions to work just take the id number of admb and put blank and the test video appears, but in my case the versions I use did not work. I took the test option as false. Even when compiling does not work, but compiling in --Prod --release and preparing the apk as if to publish the video opens correctly and all events work.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.