Skip to content
This repository has been archived by the owner on Mar 12, 2022. It is now read-only.

Platform setup

Bruno D'Luka edited this page Jan 6, 2021 · 13 revisions
  • Android
  • iOS

Google only supports native ads on mobile. Web and desktop are out of reach

Android

Add your ADMOB App ID (How to find it?) in AndroidManifest.xml.

<manifest>
  <application>
    <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
    <meta-data
      android:name="com.google.android.gms.ads.APPLICATION_ID"
      android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy">
  </application>
</manifest>

Change minSdkVersion to 19. It's the minimum sdk version required by flutter to use a PlatformView. Learn more

android {
    defaultConfig {
        minSdkVersion 19
    }
}

Enabling hybrid composition

Once initialized, you can enable hybrid composition as following:

NativeAds.useHybridComposition = true;

Or you can enable it on initialization:

NativeAds.initialize(useHybridComposition: true);

It's enabled by default on Android 19. Note that on Android versions prior to Android 10 Hybrid Composition has some performance drawbacks.

Note: It autommatically does the checking for you about the android version, so you don't need to worry about it.

iOS

iOS is currently not supported (I don't have an Apple environment :/). Feel free to create a pull request with the implementation for it :)


Next: Initialize