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.

To integrate the Mobile Ads SDK into the Flutter app, use the Yandex Mobile Ads Flutter plugin.

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

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();.