【问题标题】:How to Remove the Ads with the help of in-app purchase in flutter app如何在 Flutter 应用中借助应用内购买来删除广告
【发布时间】:2020-06-21 07:36:50
【问题描述】:

我想在用户通过应用内购买帮助购买移除广告包后禁用 Admob 广告。我想删除插页式广告和奖励广告,下面是插页式广告和奖励广告的代码:

  InterstitialAd myInterstitial = InterstitialAd(
    adUnitId: Platform.isIOS ? ios_ads : android_ads,
    listener: (MobileAdEvent event) {
      print("InterstitialAd event is $event");
    },
  );

  myInterstitial
    ..load()

    ..show(
      anchorType: AnchorType.bottom,
      anchorOffset: 0.0,

    );

激励广告

 RewardedVideoAd.instance.listener =
      (RewardedVideoAdEvent event, {String rewardType, int rewardAmount}) {
    if (event == RewardedVideoAdEvent.rewarded) {

    }
  };
  RewardedVideoAd.instance.load(adUnitId: Platform.isIOS ? ios_ads : android_ads, 
  targetingInfo: targetingInfo).then((v){

    print("log "+v.toString());
    if(v){
      RewardedVideoAd.instance.show();

    }

  });

【问题讨论】:

标签: flutter admob in-app-purchase


【解决方案1】:

有一个布尔值来跟踪是否支付了移除广告的费用。如果此布尔值设置为 true,则不要调用广告代码。

if(!isPaymentDone){
  // code to show ads
}

【讨论】:

  • 你能分享更多信息吗,如何删除应用内购买的广告
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-08-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-10
  • 1970-01-01
  • 2014-01-22
相关资源
最近更新 更多