Skip to content

Koallider/flutter_yandex_mobile_ads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter plugin for Yandex Mobile Ads SDK

This plugin supports:

Android:

  • Interstitial Ad
  • Rewarded Video
  • Banner

iOS:

  • Interstitial Ad
  • Rewarded Video
  • Banner

Installation

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

Important note for iOS:

Version 0.0.9 of this plugin uses pod YandexMobileAds version 5.4.0 which requires Swift 5.7 to build correctly.

Usage:

Init

Yandex.initialize();

Interstitial Ad

Load

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.

Show

Yandex.showInterstitial();

Rewarded Video Ad

Load and Show

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.

Banner Ad

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),
)