Installation
Installation Methods
- Gradle
- Manual
Using Gradle/Maven
- Add the Teads repository to your
project/build.gradle: - Add the Teads SDK dependency to your
app/build.gradle: - Sync your project
project/build.gradle
repositories {
maven { url "https://teads.jfrog.io/artifactory/SDKAndroid-maven-prod" }
}
app/build.gradle
dependencies {
implementation("tv.teads.sdk.android:sdk:6.3.0@aar") {
transitive = true
}
}
Huawei devices
Some of your users may have Huawei phones without Google Play services. On those phones, the SDK can only read the advertising ID if your app includes Huawei's library. Choose one option.
Option 1: Support Huawei devices
Add Huawei's repository and library. Ads on Huawei phones then carry the advertising ID.
project/build.gradle
repositories {
maven { url "https://developer.huawei.com/repo/" }
}
app/build.gradle
dependencies {
implementation("com.huawei.hms:ads-identifier:3.4.28.313")
}
Option 2: Skip Huawei support
Add nothing to your dependencies. Ads still load on Huawei phones, without the advertising ID.
If your release build uses R8 or ProGuard (minifyEnabled true), add this line to your proguard-rules.pro. Without it, older SDK versions fail the release build with Missing class com.huawei.hms.ads.identifier.... It is safe on every SDK version.
-dontwarn com.huawei.hms.ads.identifier.**
Download AAR File
For manual installation, you can download the latest TeadsSDK.aar:
- Download the latest TeadsSDK.aar from the Maven repository
- Copy it to your app's
libsfolder - Add to your
app/build.gradle:
dependencies {
implementation files('libs/sdk-6.3.0.aar')
}
Implementation Samples
The official Teads SDK sample application demonstrates best practices and integration examples.
SDK Initialization
Initialize the Teads SDK as early as possible in your app's lifecycle:
- Kotlin
- Java
import tv.teads.sdk.TeadsSDK
// Initialize the SDK with your partner key
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
TeadsSDK.configure(applicationContext, "YOUR_PARTNER_KEY")
}
}
import tv.teads.sdk.TeadsSDK;
import com.outbrain.OBSDK.OutbrainException;
// Initialize the SDK with your partner key
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
try {
TeadsSDK.INSTANCE.configure(getApplicationContext(), "YOUR_PARTNER_KEY");
} catch (OutbrainException e) {
// Handle configuration error
}
}
}
TeadsSDK.configure with your partner key is required for Feed and Recommendations only.
Global Settings Configuration
The Teads SDK provides global settings that apply across all placements. Configure these settings after SDK initialization.
Test Mode
Enable test mode for detailed logging including viewability percentage and other diagnostic information:
- Kotlin
- Java
if (BuildConfig.DEBUG) {
TeadsSDK.testMode = true
TeadsSDK.testLocation = "us" // Optional: Test specific geolocations
}
if (BuildConfig.DEBUG) {
TeadsSDK.INSTANCE.setTestMode(true);
TeadsSDK.INSTANCE.setTestLocation("us"); // Optional: Test specific geolocations
}
Crash Monitoring
Crash monitoring is enabled by default. To disable:
- Kotlin
- Java
TeadsSDK.isCrashMonitoringEnabled = false
TeadsSDK.INSTANCE.setCrashMonitoringEnabled(false);
Settings
Find the full settings list for each placement in the Settings Configuration.
Event Handling
Use Placement Events. That page is the source for the delegate, event names, and the click-URL rule.
Best Practices
1. Placement Lifecycle Management
Media, Media Native and Interstitial placements
Call clean() when the host is destroyed. Each format page shows this on onDestroy.
Feed and Recommendations placements
For Feed and Recommendation placements, ensure you load only one ad instance per screen.
To prevent redundant ad requests during view recycling (RecyclerView) or recomposition (LazyList), cache the loaded ad by holding a strong lifecycle aware reference to it.
2. Error Handling
Handle TeadsAdPlacementEventName.FAILED on the unified delegate. See Placement Events.
Next Steps
- Review the Direct integration if you load ads with Teads SDK
- Review the Mediation guides if Teads is a demand source inside another mediation SDK
- Review the Prebid guides for header bidding
For additional support, see Support