Google Ads

An easy way to add all google ads to your flutter app.

How to use it

  1. Add the google_mobile_ads package using flutter pub add google_mobile_ads.

  2. Update your Info.plist as follows:

<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
<key>SKAdNetworkItems</key>
  <array>
    <dict>
      <key>SKAdNetworkIdentifier</key>
      <string>cstr6suwn9.skadnetwork</string>
    </dict>
  </array>
  1. Add the AdMob App ID (identified in the AdMob UI) to the app’s android/app/src/main/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>
  1. Add id’s of (rewardedID &&interstitialID && bannerID) in ads.dart inside if(kReleaseMode).

  2. To use banner just write AdBanner() inside any widget.

  3. To use rewarded just write AdReWarded.instance.createRewardedAd() inside initState() method and write AdReWarded.instance.dispose inside dispose() method.

  4. To use interstitial just write AdInterstitial.instance.createInterstitialAd() inside initState() method and write AdInterstitial.instance.dispose inside dispose() method.

GitHub

View Github