Getting started with Fyber SDK

Adding the SDK to your Eclipse project

Below is the recommended method of adding the SDK to your Eclipse Project.

Adding the .jar File to your Java Classpath

The first approach consists of adding the SDK’s .jar file to your Java classpath. We provide an example of doing this, by using the Eclipse IDE.

  1. Download the latest version of the Fyber SDK from the Downloads page.
  2. Copy the SDK’s .jar into your project. We suggest you to create a libs folder in your project file tree, that will contain the jar files.
  3. Bring up the project properties window. Right click on your project folder and select Properties.
  4. On the left column of the properties window select Java Build Path.
  5. On the main panel of the same window select the Libraries tab. Click on the Add JARs… button. Select the corresponding SDK JAR file from your project file tree.
  6. Click OK on the JAR selection window and click OK on the Preferences window.

Installation with Gradle/Maven

We’ve added support for Gradle/Maven integrations since version 7.1.0.

If you’re using Android Studio for your project, you need to add the following information into your build.gradle file.

repositories {
  maven {
    name "Fyber's maven repo"
    url ""

dependencies {
  compile 'com.fyber:fyber-sdk:8.22.2'

If you’re using Maven-based project, add the following code snippet in your pom.xml file



Integrating Google Play Services

We recommend you use the Google Play Services, as otherwise we aren’t able to access the Google Advertising ID. This will lead 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.

Warning: If you are using Fyber SDK below 8.7.0 and your project uses ProGuard, be sure to follow Google’s instructions to prevent it from stripping away required classes (see the ProGuard section of the integration guide) as well as our own instructions.

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

# Google Advertising Id

-keep class** { *; }

Starting The Fyber SDK

  1. Find your App ID and Client Security Token in the Fyber dashboard in your app’s settings tab under SDK Configuration: SDK Configuration
  2. Make sure your application manifest contains the permissions for INTERNET.
  3. Find a point in your application’s code that runs when it starts. We recommend the onResume method of your main activity. You should call the SDK from that point, in order to create the credentials to be used in every call to Fyber’s servers.
  4. Import the com.fyber.Fyber class into the source file where you will call the SDK.
  5. Add the callback code:
Fyber.with(appId, activity)

where - appId is your application ID from the Fyber Developer Dashboard. - The start method throws a IllegalArgumentException if an empty appId is provided. - activity is a reference to your app’s activity.

You can also chain methods to Fyber.with:

Fyber.with(appId, activity)
    .withUserId (UserID)
    .withSecurityToken(Security Token)

The Fyber.with method will initialize credentials. These will be used by other methods of the Fyber SDK, for launching the offer wall or interstitial ads.


Fyber.with(appId, activity)
    .withUserId (UserID)
    .withSecurityToken(Security Token)

You have now completed the steps necessary to integrate the Fyber SDK as a publisher. For further information on the ad format you want to use, please see the side navigation.

Using the Fyber SDK for Advertising - Next Step

To use the Fyber SDK for advertising, you must first complete this following section on implementing the Fyber broadcast receiver before proceeding to the Advertising section.

The AndroidManifest.xml file should contain the following permissions:

    <uses-permission android:name="android.permission.INTERNET" />

Using Fyber SDK with ProGuard

The standard Fyber SDK doesn’t require any specific proguard.cfg entry. However, when using the Fyber Mediation for either Rewarded Video or Interstitials, add this to the proguard.cfg file of your project:

# Fyber Mediation

-keep class com.fyber.mediation.MediationConfigProvider {
    public static *;
-keep class com.fyber.mediation.MediationAdapterStarter {
    public static *;

-keepclassmembers class** {
    void setValue(java.lang.String);

Based on the networks you are integrating, the configuration might need to be extended with ProGuard settings specific to each one of these networks. The required entries for each network can be found here:

Adding Custom Parameters

If you are interested in adding a custom parameter to your Android SDK request, you can use the settings object you get after you start the SDK. Here’s an example of adding a custom parameter:

Fyber.Settings settings = Fyber.with(appId, this).start();

// creating a map of parameters to be used across all products' requests
Map mapOfParameters = new HashMap<String,String>();
mapOfParameters.put("pub0", "value1");
mapOfParameters.put("pub1", "value2");

//adding a custom parameter to be used across all products' requests
settings.addParameter("pub2", "value3")
//adding a list of custom parameters to be used across all products' requests

Retrieving the User Id

After starting the SDK you can access the user ID by calling the getUserId() method on the Fyber.Settings:

Fyber.Settings settings = Fyber.with(appId, this).start();
String userId = settings.getUserId();

Changing the User Id

Rewarded user can be set while starting the sdk by calling

Fyber.with(appId, activity)

or can be changed from Settings object that can be retrieved after starting the sdk. Calling method settings.updateUserId(String userId) will change the userId after the sdk is started.