Current SDK Version: 2.4.0
This guide is intended for developers who are integrating the
- Android 4.1 (API Level 16)+
- Google Play Services 11.4.0+
Information
All Fyber SDKs and supported mediated networks work in conjunction with Android's 64-bit architecture.
Fyber supports both Gradle dependencies or manual download to integrate our SDK:
Gradle
Add Fyber's maven repository and dependencies to your gradle build script:
- Add the following to your app’s project level build.gradle file inside the repositories section:
In project level build.gradle there are usually two repositories
sections - one for buildscript and one for allprojects. Add the entry in allprojects.
allprojects {
repositories {
maven {
url "https://fyber.bintray.com/maven"
}
}
...
}
- Save your file
- Add the following to your app’s app level build.gradle file inside the dependencies section:
dependencies {
...
implementation 'com.fyber:fairbid-sdk:2.4.0'
...
}
- Download the
- Extract inner zip file
- Import the aar packages into your project.
- Add Gson into your project. A detailed guide can be found here.
The Google Play Services SDK must be added to your project. Follow Google's documentation on integrating the Google Play Services SDK into your app.
Only the Ads and Location APIs are included. If you are using a Gradle build system with Android Studio adding the following to build.gradle is sufficient:
- Add the following to your app’s build.gradle:
implementation 'com.google.android.gms:play-services-ads:17.1.1' //11.x and onwards is supported
//Optionally, add the location services -
implementation 'com.google.android.gms:play-services-location:11.+'
- Modify your Android Manifest
- Add the following to your app’s manifest.xml within the <application> tag:
<!-- Google Play Services -->
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
Google Play Services Meta-Data
This tag is not allowed outside the application tag but will not raise any critical warning if you put it outside.
- Add the following attribute to the <application> tag to enable hardware acceleration:
<application android:hardwareAccelerated="true" ...>
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:
<!-- 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" />
In addition to integrating the
Third Party Manifest Modifcations
You must add additional additional manifest modifications for each third party network. These entries are found by selecting your third party adapters here.
Automatic Detection and Initialization
The
Targeting Android P
When targeting Android P and using video ads, you must add an exception rule to 'localhost' found in your apps Network Security Configuration.
- Make the Network Security Configuration xml with the code below:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">127.0.0.1</domain>
</domain-config>
</network-security-config>
- Modify your manifest of your app to point to this file.
The following code is an example of how to create this entry:
<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
<application android:networkSecurityConfig="@xml/network_security_config"
... >
...
</application>
</manifest>
More information can be found here.
Updated 13 days ago
What's Next
Initialize the SDK |