Welcome to the Fyber Android Developer Portal

Let's get started.


Integrating the SDK


The minimum supported version is:

  • API level 14
  • Android ics, 4.0

Step 1: Adding the Fyber SDK to your Project

Add the Fyber Maven repository and Fyber SDK dependency to your build.gradle file.

Please Note!

All Fyber SDKs and supported mediated networks work in conjunction with Android's 64-bit architecture.

repositories {
  maven {
    name "Fyber's maven repo"
    url "https://fyber.bintray.com/maven"

dependencies {
 implementation 'com.fyber:fyber-sdk:8.22.3'

Integrating Google Play Services

We recommend you use the Google Play Services, as otherwise we aren't able to access your Google Advertising ID. This leads to limited ad inventory, as an increasing number of advertising campaigns require the identifier. This ID is also essential for tracking daily active users (DAU) on your app.

If you have not integrated Google Play Services yet, please follow the Google Play Services integration guide.

Please Note!

Fyber SDK only requires the com.google.android.gms:play-services-ads library. Your app may require additional APIs from Google Play Services.

You could simply include the entire library but doing so risks exceeding the DEX limit. It's optimal to only include the services you need.

To ensure we can access the Google Advertising ID, please include the following lines for Google Play Services:

# Google Advertising Id

-keep class com.google.android.gms.ads.identifier.** { *; }

Please Note!

If your project uses ProGuard, be sure to follow Google's instructions to prevent it from stripping away required classes.

Step 2: Adding User Consent

The General Data Protection Regulation requires you to scope your user's consent. For more information on GDPR, click here.

A user is within the GDPR scope for your app when one or all of the following apply:

  • The user is currently located in the EU
  • The user has registered with the app as an EU resident
  • The app is specifically targeted to EU users

Once you have collected the user’s consent and/or consent string, you can pass them onto the SDK using the following API:

User.setGdprConsent(isGdprConsentGiven, context); //from import.com.fyber.user.User;

Map<String,String> consentData = fetchConsentDataFromCmp();
User.setGdprConsentData(consentData, Context context);

isGdprConsentGiven is a boolean. It is true if you have the user’s consent. If you do not have the user's consent, it is false.

When passing an actual Consent String please use the "gdpr_consent_string" dictionary key only.
context is a valid Android Context.
If you don’t pass the user’s consent to the SDK, only contextual ads will be shown to that user.

In order to clear consent flag and consent data the following API can be used:


We recommend that the first time you gather the user’s consent, you pass it onto the SDK before starting the SDK. The SDK will then take the user’s consent into consideration when initializing. In the following sessions, you will only need to call the API if the user updates his or her consent.

More information on GDPR can be found under the GDPR Resource Page and FAQs.

Step 3: Starting the SDK

You’ll need to start the Fyber SDK before being able to use any Fyber product.


Starting up the Fyber SDK when the main thread is performing a heavy operation (loading assets, etc) can result in an unresponsive state (for example, an ANR). This may lead to the app being down ranked in the app store. This is especially true for slower devices. For these reasons, It is advised to initialize the Fyber SDK after all the heavy operations are completed.

To do this, determine a point in your application’s code that runs when the application starts. We recommend the onResume method of your main activity.

import com.fyber.Fyber;


protected void onResume() {
	Fyber.with(appId, activity)

The securityToken and appId are required, and can be found in the Settings of your app in the Dashboard. The userId should uniquely identify the user of your app.

Common Error!

Fyber requires user ids to be unique within your app. You may not hardcode or share user ids. If necessary, the Fyber SDK can assign unique user ids for you (see below).

Automatically Generated user ids

The previous method is our preferred method of starting the SDK.

If you do not want to set a userId yourself and would rather the Fyber SDK create it for you, the Fyber SDK will do so when you omit the call to withUserId(...) in your code:

import com.fyber.Fyber;


protected void onResume() {
	Fyber.with(appId, activity)

This generates the required unique userId on the first launch of the application and stores it for subsequent launches.

Subsequent usage of the Fyber SDK during your application's lifecycle will reuse the parameters passed to this call. If the user re-installs the app, a new userId will be generated.

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.

  1. Make the Network Security Configuration xml with the code below:
<?xml version="1.0" encoding="utf-8"?>
   <base-config cleartextTrafficPermitted="true">
           <certificates src="system" />
   <domain-config cleartextTrafficPermitted="true">
       <domain includeSubdomains="true"></domain>
  1. 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"
                    ... >

More information can be found here.

You are now ready to start using Fyber's products!

Not sure which products you'd like to use? Please review the Introducing Our Products section for a discussion of the benefits of all Fyber products.

Updated about a month ago

Integrating the SDK

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.