[英]Showing Interstitial ads every 5 clicks
I have an ElevatedButton
to call family member using flutter_phone_direct_caller
.我有一个
ElevatedButton
可以使用flutter_phone_direct_caller
给家人打电话。 I wish to show interstitial ads
once every 5 clicks user pushes the ElevatedButton.我希望每 5 次点击用户按下 ElevatedButton 就显示一次
interstitial ads
。 The code below works fine but after 5 clicks, the interstitial ads show up every time.下面的代码工作正常,但点击 5 次后,每次都会显示插页式广告。
ElevatedButton(
onPressed: () {
admobHelper.createInterad();
callFamilyMember();
setState(() {
clickCount=clickCount+1;
if(clickCount>5){
admobHelper.showInterad();
}
}
);
},
Replace your code with this one.用这个替换你的代码。 you have to set clickcounts to 0 on show ad.
您必须将展示广告的点击次数设置为 0。
ElevatedButton(onPressed: () {
admobHelper.createInterad();
callFamilyMember();
setState(() {
clickCount = clickCount + 1;
if (clickCount > 5) {
admobHelper.showInterad();
clickCount = 0;
}
});
}),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.