Sag*_*nde 5 in-app-purchase admob flutter
我想在用户购买“通过应用内购买帮助删除广告”包后禁用 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,
);
Run Code Online (Sandbox Code Playgroud)
奖励广告
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();
}
});
Run Code Online (Sandbox Code Playgroud)
K P*_*ddy -3
使用布尔值来跟踪是否为删除广告付费。如果此布尔值设置为 true,则不调用广告代码。
if(!isPaymentDone){
// code to show ads
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1816 次 |
最近记录: |