Current SDK Version: 3.39.0
Prerequisites
- Android 4.1 (API Level 16)+
- Google Play Services 11.4.0+
Important
All DT SDKs and supported mediated networks work in conjunction with Android's 64-bit architecture.
Step 1: Integration
DT supports both Gradle dependencies and manual download to integrate our SDK:
Gradle
Note that the Android integration changes as of version 3.23.0. You will integrate a plugin instead of a SDK.
Add DT's maven repository and plugins to your gradle build script:
- Add the following to your project’s root level
build.gradle
file inside therepositories
section:
In root level build.gradle
there are usually two repositories
sections - one for buildscript
and one for allprojects
. Add the entry in allprojects
.
allprojects {
repositories {
mavenCentral()
}
...
}
- Add the following to your project’s app level
build.gradle
file inside theplugins
section (further documentation):
plugins {
...
id 'com.fyber.fairbid-sdk-plugin' version '3.39.0'
...
}
- Starting from DT FairBid SDK 3.0.0, if you support Android SDK below 26, you must add the following snippet to the Android section (for Java Version Compatibility):
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
}
Historically, Android projects have been using Java 1.7 since it was the best way to ensure compatibility across Android versions. Android Studio has been supporting partial compatibility with Java 1.8 since version 3.0.0. As some of our partners begin moving to 1.8, we follow suit.
This allows our team (and our partners) to leverage some new features of the Java language with no implications on runtime/API compatibility. However, it enforces the same type of declaration in the projects integrating the DT FairBid SDK.
Manual Download
- Download the DT FairBid SDK
- Extract inner zip file
- Import the
aar
packages into your project.
Step 2: Modifying Your Manifest.xml
If your application targets API 31 or greater (Android 12) you must declare the AD ID permission:
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
Failing to do so, prevents the DT FairBid SDK (and all mediated networks) from accessing the Android's Advertising ID resulting in reduced ad inventory and thus, lower revenues.
More information about this permission can be found here.
Optional Permissions
The following permissions are not required for our SDK or 3rd-party SDKs to function, but including them in your AndroidManifest.xml may result in improved eCPM and user experience:
Optional Permissions
<!-- Optionally used by FairBid -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Step 3: Adding 3rd Party SDKs
In addition to integrating the DT FairBid SDK, publishers who are using DT FairBid Mediation, must integrate chosen 3rd-party networks' SDKs into their app.
- Set up your app in the network's dashboard and in the DT Console. A step-by-step guide can be found here.
- Download the relevant network's SDK. Supported networks and their SDKs can be found here.
- You must add additional manifest modifications for each third party network. These entries are found by selecting your third party adapters here.
Important
The DT FairBid SDK automatically detects and initializes SDKs from 3rd-party networks.
Building for AndroidX
If you, or any of your integrated mediation networks use AndroidX libraries, you can update your build to ensure compatibility. To use androidx-namespaced libraries in a new project, you must set the compile SDK to Android 9.0 (API level 28) or higher.
If you have a native integration, add the following parameters to your gradle.properties
file:
Groovy
android.useAndroidX=true
android.enableJetifier=true
If you have a Unity integration, the way to add gradle properties to the build differs from the native build. This is because your mainTemplate.gradle
does not really belong to a gradle project in the place it is located.
Therefore, you should provide the previous properties by adding the following to your mainTemplate.gradle
.
Groovy
project.ext.set('android.useAndroidX', true)
project.ext.set('android.enableJetifier', true)
It is important to write this before you apply the following plugin (test):
Groovy
apply plugin: 'com.android.application'
More information about AndroidX here.