repeat the interstatial ad after 30 sec in flutter code example
Example 1: showing ads every x seconds flutter
import 'dart:async';
Timer _timerForInter;
@override
void initState() {
_timerForInter = Timer.periodic(Duration(seconds: 20), (result) {
_interstitialAd = createInterstitialAd()..load();
});
super.initState();
}
@override
void dispose() {
_timerForInter.cancel();
_interstitialAd.dispose();
super.dispose();
}
Example 2: how to show ad every second flutter
import 'dart:async';
Timer _timerForInter;
@override
void initState() {
_timerForInter = Timer.periodic(Duration(seconds: 20), (result) {
_interstitialAd = createInterstitialAd()..load();
});
super.initState();
}
@override
void dispose() {
_timerForInter.cancel();
_interstitialAd.dispose();
super.dispose();
}