Created
May 1, 2020 01:38
-
-
Save luizmarcus/0c8f6f2d13eb74a67663493f0b47bfdf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AdmobInterstitial interstitialAd; | |
@override | |
void initState() { | |
super.initState(); | |
interstitialAd = AdmobInterstitial( | |
adUnitId: getInterstitialId(), | |
listener: (AdmobAdEvent event, Map<String, dynamic> args) { | |
if (event == AdmobAdEvent.closed) interstitialAd.load(); | |
handleEvent(event, args, 'Interstitial'); | |
}, | |
); | |
interstitialAd.load(); | |
} | |
AdmobBanner getBanner(AdmobBannerSize size) { | |
return AdmobBanner( | |
adUnitId: getBannerId(), | |
adSize: size, | |
listener: (AdmobAdEvent event, Map<String, dynamic> args) { | |
handleEvent(event, args, 'Banner'); | |
}, | |
); | |
} | |
void showInterstitial() async { | |
if (await interstitialAd.isLoaded) { | |
interstitialAd.show(); | |
} else { | |
print("Interstitial ainda não foi carregado..."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment