Integrate Tencent GDT with Mediation

  • This guide explains how to integrate Tencent GDT ads into your Android app using Google Mobile Ads mediation.

  • You'll need an Android app with the Google Mobile Ads SDK and a Google Ad Manager account with mobile app mediation set up.

  • Integration involves adding the Tencent GDT SDK and adapter to your project, configuring your AndroidManifest.xml, and initializing ad objects with an Activity instance.

  • The Google Mobile Ads SDK handles communication with Tencent GDT, fetching ads on your behalf.

This guide is intended for publishers who are interested in using Google Mobile Ads mediation with Tencent GDT. It walks through the setup of a mediation adapter to work with your current Android app and the configuration of additional settings.

Tencent GDT Resources
Documentation
SDK
Adapter
Customer support

Prerequisites

Add Tencent GDT to your project

Include network adapter and SDK

Download the Tencent GDT SDK and adapter from the previous links.

In Android Studio, include the adapter and SDK files in your project's libs folder. Make sure that your app-level Gradle file includes the following:

Kotlin

dependencies {
    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar", "*.jar"))))
    // ...
}

Groovy

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
    // ...
}

Configure the AndroidManifest.xml file

Modify your AndroidManifest.xml file as instructed in the Tencent GDT documentation.

Your app doesn't need to call Tencent GDT directly—Google Mobile Ads SDK calls the Tencent GDT adapter to fetch ads on your behalf. If necessary, you can specify any additional request parameters. The rest of this page details how to provide more information to Tencent GDT.

Initialize your ad object with an Activity instance

In the constructor for a new ad object (for example, AdManagerAdView), you must pass in an object of type Context. This Context is passed on to other ad networks when using mediation. Some ad networks require a more restrictive Context that is of type Activity and may not be able to serve ads without an Activity instance. Therefore, we recommend passing in an Activity instance when initializing ad objects to ensure a consistent experience with your mediated ad networks.