Adding the Yandex Mobile Ads Flutter plugin

Warning.

This is an archived version of the documentation. Actual documentation for all platforms can be found here.

  1. About the plugin
  2. Adding the plugin to your project
  3. Configuring for specific platforms
  4. Initializing the library

About the plugin

Flutter is a popular technology for creating mobile apps. Developers use it to write single code that can be run on different operating systems, including Android and iOS.

Now, it will be easier for you to monetize Android and iOS apps created with Flutter. All our partners in the Yandex Advertising Network can now use the plugin to enable Yandex-based monetization in their apps.

This plugin supports loading and display of the following ad types:

Requirements
  • Flutter 2.5.0 or higher.
  • Android 4.1 or higher.

    Video ads are selected for devices with Android 5.0 or higher.

  • iOS 12.0 or higher.

    Check the additional steps to ensure that iOS 14 (or higher) works properly.

    Latest Xcode version with enabled command-line tools.

  • Registering an account in the Yandex Advertising Network.

Adding the plugin to your project

Install the Yandex Mobile Ads Flutter plugin in your project. From the root of the project, call the command:

flutter pub add yandex_mobileads

Once the plugin is added, you'll see the following line with a dependency in the pubspec.yaml file:

dependencies:
    yandex_mobileads: ^X.X.X

X.X.X: The plugin's current version number.

Configuring for specific platforms

The new permission com.google.android.gms.permission.AD_ID is already added in the Yandex Mobile Ads SDK. It enables you to use AD_ID to select relevant ads. You can delete the permission if necessary.

Learn more about the permission and ad ID

The ad ID is a unique identifier provided by Google Play services for displaying ads to users who opt in to personalized ads. Users can opt out of ad personalization or reset their ID in the settings. In this case, advertising networks won't be able to use the ID to select relevant ads for the user.

How to delete the permission

If some policies (such as Google Play's Families Policy) do not allow the use of ad IDs, you can delete the permission from the AndroidManifest.xml file.

<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>

Initializing the library

In initState of your app's widget, add the line: MobileAds.initialize();.