在执行launchURL之前加载我的广告。
buttonactionL: () async{
await StartApp.showInterstitialAd();
String url = "https://google.com";
_launchURL(url);
},发布于 2021-07-09 01:54:21
调用showAds方法,在onAdClosed和onAdFailedToLoad完成后执行launchURl操作:
void showAds() {
_interstitialAd = InterstitialAd(
adUnitId: AdHelper.interstitialAdUnitId,
request: AdRequest(),
listener: AdListener(onAdLoaded: (ad) {
print("Ad Loaded");
showAds();
}, onAdClosed: (ad) {
print("Closed Ad");
}, onAdOpened: (ad) {
print("Opened Ad");
}, onAdFailedToLoad: (ad, error) {
print("Failed to load Ad $error");
}),
);
_interstitialAd.load();
}https://stackoverflow.com/questions/66299384
复制相似问题