GuidesAPI ReferenceRelease Notes
HomeLog InHome
Guides

GAM module (legacy)

Use this module for Google Ad Manager custom native and banner ads with Experiences SDK through 1.19. It uses the legacy Google Mobile Ads SDK.

For Experiences SDK 1.20 or later, use the GAM Next-Gen module. The API matches. See the migration guide.

Don't add both the legacy GAM module and the GAM Next-Gen module to the same app. The legacy Google Mobile Ads SDK and the GMA Next-Gen SDK can't run together.

Set up the GAM module (legacy)

1. Declare the dependency

In your app module build.gradle:

// Experiences SDK
def blazeSDK = '<VERSION>'

dependencies {  
    implementation group: "com.blaze", name: "gam", version: "${blazeSDK}"  
}

2. Set your Ad Manager app ID

Add your Ad Manager app ID to the app Manifest. Find it in Google Ad Manager under Inventory > Apps (Google labels it App ID):

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <application>

      ...

        <!-- Google Ad Manager -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxx~xxxxxxxx" />

    </application>
</manifest>

3. Enable ads

Call these from your Activity or Application class.

Custom native ads

BlazeGAM.enableCustomNativeAds(
  context = applicationContext,
  defaultAdsConfig = gamCustomNativeAdsDefaultConfig,
  delegate = gamCustomNativeAdsDelegate
)

To disable:

BlazeGAM.disableCustomNativeAds()

Banner ads

BlazeGAM.enableBannerAds(
  context = applicationContext,
  delegate = gamBannerAdsDelegate
)

To disable:

BlazeGAM.disableBannerAds()

Did this page help you?