-
Notifications
You must be signed in to change notification settings - Fork 11
Ads version 3.0.0 (nullsafe) Video not showing up #39
Copy link
Copy link
Open
Description
Hello there.
Just wanted to ask if there is anything new how should we display the video ads in the beta version of the null-safe version?
This is my code:
static Future<bool> showRewardAd({required Function userReward, required Function onAdClose}) async {
return getInstance().setVideoAd(
show: true,
testDevices: [],
childDirected: false,
adUnitId: AdManager._rewardedAdUnitId,
contentUrl: 'https://makromapa.pl',
keywords: <String>['food', 'fit', 'calories'],
listener: (AdsEvent event, {String? rewardType, int? rewardAmount}) {
if ([AdsEvent.onAdLoaded, AdsEvent.onAdOpened, AdsEvent.onAppEvent].contains(event)) {
_logger.d("Reward Ad | Following RewardedVideoAd Event was fired - $event");
SystemChrome.setEnabledSystemUIOverlays([]);
}
if (AdsEvent.onRewardedAdUserEarnedReward == event) {
_logger.i("Reward Ad | User granted reward - $rewardType, ($rewardAmount)");
userReward();
}
if (AdsEvent.onAdFailedToLoad == event) {
_logger.e("Reward Ad | failed to load Reward Ad");
onAdClose();
}
if (AdsEvent.onAdClosed == event) {
_logger.e("Reward Ad | closed");
onAdClose();
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
}
})
.then((value) => getInstance().showVideoAd());
}
...
static Ads getInstance() {
if (_ads != null) {
return _ads!;
}
_ads = Ads(
trackingId: AdManager._appId,
videoUnitId: AdManager._rewardedAdUnitId,
testing: false,
testDevices: [],
childDirected: false,
contentUrl: 'https://example.pl',
keywords: <String>['test'],
listener: _eventListener,
);
return _ads!;
}
The listener gets with the AdsEvent.onAdLoaded event. There isn't anything else fired. This flow worked on the older version ;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels