简体   繁体   English

Ionic 3 / Cordova Admob奖励视频广告

[英]Ionic 3 / Cordova Admob Rewarded Video Ads

Tried to make the Admob Rewarded videos work in Ionic 3 but couldn't make it happen! 试图使Admob Rewarded视频在Ionic 3中正常运行,但无法实现! the ad doesn't trigger, have searched around stack and ionic forum but couldn't find a healing answer, I'm using Admob-free plugin 广告没有触发,已经在堆栈和ionic论坛上进行了搜索,但是找不到治愈的答案,我使用的是无Admob插件

Here's what I have so far: 这是我到目前为止的内容:

async showRewardedAds() {
    try {
      const rewardedConfig: AdMobFreeRewardVideoConfig = {
        id: "ID goes here...",
        isTesting: false
      }
      this.adMobFree.rewardVideo.config(rewardedConfig);
      const result = await this.adMobFree.rewardVideo.prepare();
      await this.adMobFree.rewardVideo.show();
      console.log(result)
    }
    catch (e) {
      console.log(e)
    }
  }

Whether I'm emulating it on Android or browser, nothing seems to work! 无论是在Android还是浏览器上进行仿真,似乎都无法正常工作! Could anyone have some ideas or encountered this before? 任何人都可以有一些想法或以前遇到过吗?

  • Android platform version: android@6.4.0 Android平台版本:android@6.4.0
  • Ionic v3 离子v3

I have never used this plugin, but reading the docs ( https://ionicframework.com/docs/native/admob-free/ ) 我从未使用过此插件,而是阅读文档( https://ionicframework.com/docs/native/admob-free/
I think you should try something like this, handling the catch and the success of the promise 我认为您应该尝试这样的事情,处理问题并实现诺言的成功

showRewardedAds() {
      const rewardedConfig: AdMobFreeRewardVideoConfig = {
        id: "ID goes here...",
        isTesting: false
      }
      this.adMobFree.rewardVideo.config(rewardedConfig);
      this.adMobFree.rewardVideo.prepare().then((data:any)=>{
        // HERE YOU WILL NEED TO MAKE THE SAME THING
        // catching the Error or the Success of the Promise
        this.adMobFree.rewardVideo.show()
      })
      .catch((e:Error)=>{
         console.log("Error ",e);
      });
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM