- Interstitial Ad
- Rewarded Video
- Banner
- Interstitial Ad
- Rewarded Video
- Banner
To instrument your flutter based mobile application with Yandex Mobile Ads Plugin, add this to your package's pubspec.yaml file:
dependencies:
...
flutter_yandex_mobile_ads: ^0.0.12
Version 0.0.9 of this plugin uses pod YandexMobileAds version 5.4.0 which requires Swift 5.7 to build correctly.
Yandex.initialize();
listener(YandexAdEvent event, dynamic args) {
if (event == YandexAdEvent.adReady) {
interstitialLoaded = true;
} else if (event == YandexAdEvent.adLoadFailed) {
debugPrint("Failed to load Interstitial Ad");
}
}
Yandex.interstititalListener = listener;
Yandex.loadInterstitial("R-M-DEMO-interstitial");
Replace "R-M-DEMO-interstitial" with your placement key.
Yandex.showInterstitial();
var listener = (YandexAdEvent event, dynamic args) {
if (event == YandexAdEvent.adReady) {
Yandex.showRewardedVideo();
} else if (event == YandexAdEvent.adLoadFailed) {
debugPrint("Failed to load Rewarded Video");
} else if (event == YandexAdEvent.adRewarded) {
debugPrint("Successfully rewarded");
}
};
Yandex.rewardedListener = listener;
Yandex.loadRewarded("R-M-DEMO-rewarded-client-side-rtb");
Replace "R-M-DEMO-rewarded-client-side-rtb" with your placement key.
YandexBanner(
adUnitId: "R-M-DEMO-300x250",
size: YandexBannerSize.stickySize(MediaQuery.of(context).size.width.toInt()),
)
or
YandexBanner(
adUnitId: "R-M-DEMO-300x250",
size: YandexBannerSize.flexibleSize(320, 320),
)