Integrating the Android SDK

Before Starting

Integrating the Android SDK begins once you decide which of the modules you want to integrate.

You can choose from the following:

  • ia-sdk-core (Required for all)
  • ia-mraid-kit (HTML/MRAID content)
  • ia-video-kit ((Rendering/Video content)


We recommend including all the libraries and configuring the content at the placement level.

Unity Wrapper

In addition to the native Android and iOS SDKs, the Marketplace SDK supplies a unity wrapping package, which can be used to import the Marketplace SDKs into a Unity project.

The Marketplace Unity wrapper package is built upon the Google Unity jar Resolver. It works by adding the native Android/iOS dependencies to the exported native projects made at Unity run time.

To use the Unity Wrapper, download the relevant unitypackage file and import it into your project.


Currently, the Marketplace Unity package does not provide any Unity bridging for requesting ads using Unity APIs.

Step 1: Integrating the SDK in your App

Fyber supports both Gradle dependencies or manual download to integrate our SDK:


Add Fyber's maven repository and dependencies to your gradle build script:

  1. 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 {
    // add this
  // ...
  1. Save your file
  2. Add the following to your app’s app level build.gradle file inside the dependencies section:


// define the fyber marketplace version as a variable for easier upgrades
def fyberMarketplaceVersion = '7.8.2'

dependencies {
    // ...

    // add the relevant fyber marketplace libraries
    implementation "com.fyber.vamp:core-sdk:${fyberMarketplaceVersion}"
    implementation "com.fyber.vamp:video-kit:${fyberMarketplaceVersion}"
    implementation "com.fyber.vamp:mraid-kit:${fyberMarketplaceVersion}"
    // ...
  1. Save the file.

Manual Download

  1. Download the Fyber Marketplace SDK. If you do not have an account, create one first.
  2. Copy the ia-sdk-lib-release-x.y.z.aar from the InneractiveAdSDK folder into your project libs folder.
  3. Add the following to your project's build.gradle file:

Add Script

repositories { 
    // ...
    // add a flat dir repository
    flatDir {
        dirs 'libs'

def fyberMarketplaceVersion = "7.8.2"

dependencies {
  // add the fyber marketplace AAR libraries
  implementation (name:"ia-sdk-core-release-${fyberMarketplaceVersion}", ext:'aar')
  implementation (name:"ia-video-kit-release-${fyberMarketplaceVersion}", ext:'aar')
  implementation (name:"ia-mraid-kit-release-${fyberMarketplaceVersion}", ext:'aar')

Step 2: Integrating Google Play Services

We recommend using the Google Play Services, otherwise we unable 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.

  1. Add the following to your build.gradle dependencies section for Google Play Services:

Adding Dependencies

dependencies {
    implementation ('')
    //Optionally use only the ads identifier library
//implementation ('') // or implementation ('') }

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

Step 3: Updating Your Android Manifest File

  1. The following mandatory permissions are automatically merged into your application's AndroidManifest.xml:

Adding Mandatory Permissions

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


ACCESS_NETWORK_STATE permission is used to differentiate Wifi from a cellular network.

  1. Add the following permissions to enable your app to get richer and broader demand

Recommended permissions for better targeting

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Step 4: Initializing the SDK

Once you have added all your Android Manifest information and are ready to start requesting ads, you must initialize the Inneractive Ads SDK :

  1. Call InneractiveAdManager.initialize(context, <"appiD">), and pass on your Activity or application context:

Pass Your Activity Context 

public class MainActivity extends Activity {
   protected void onCreate(Bundle savedInstanceState) {
      InneractiveAdManager.initialize(this, ""); 
   protected void onDestroy() {
      if (isFinishing()) {
           //Optionally destroy the SDK after the activity has been destroyed
InneractiveAdManager.destroy(); } } }

Optionally, When you're finished using the library and don't intend to display more ads, call InneractiveAdManager.destroy() to release any resources being used by the SDK.
Note - If you intend to destroy the library from within your activity's onDestroy method, check to ensure that the activity has really finished.

Initialization Callback

Starting from version 7.5.4 of the Marketplace SDK, it is possible to add an initialization callback which notifies about the initialization status of the SDK.

The callback can be optionally passed to the InneractiveAdManager in the following manner:


InneractiveAdManager.initialize(context, appId, new OnFyberMarketplaceInitializedListener() {
           public void onFyberMarketplaceInitialized(FyberInitStatus status) {
               // ...

Where the Status being returned in the initialized callback is:

  • SUCCESSFULLY - when the SDK has been successfully initialized.
  • FAILED_NO_KITS_DETECTED - when only the “core” Fyber Marketplace library has been detected. When this is the status, please check your dependencies and add the “video-kit”, “mraid-kit” to it. More details here
  • FAILED - When the SDK has failed to communicate with our servers and could not be initialized at this time.
  • INVALID_APP_ID -the appId being passed to the initialize is incorrect. Please check your configuration or contact us for assistance. Please see here

Important: Regarding the "Failed" Status

Fyber currently recommends using the SDK and performing ad requests when the FyberInitStatus is “FAILED”, as the SDK, internally, attempts to re-initialize itself when an AdRequest is executed. The above callback is not invoked in such cases.

Passing a User ID to the SDK (from v.7.7.0)

The following code snippet demonstrates how to set a User ID for this SDK session.


The initial method of the SDK must be called in advance and there is no need to wait for the onFyberMarketplaceInitialized callback

String userId = ...;
//Without reflection, using an import of the InneractiveAdManager class -

//Optionaly, using reflection as an example -
Class FyberInneractiveAdManagerClass = 
Class.forName("com.fyber.inneractive.sdk.external.InneractiveAdManager"); Method setUserIdStaticMethod =
FyberInneractiveAdManagerClass.getDeclaredMethod("setUserId", String.class); setUserIdStaticMethod.invoke(null, userId);

You have completed the basic integration of the Android SDK! Now it's time to integrate other ad types:


Review the below GDPR related instructions (available starting Android v7.1.5 SDK and legacy version v6.5.6) 

Locating your Spot ID App ID

Make sure you enter the correct credentials. Follow the instructions below to find your Spot ID and App ID:

From the Inventory window, select the app for which you want to locate the ID.

The Spot ID is located in brackets, next to the spot name.  Click on it to save the ID to the clipboard.


To locate the App ID, click the three horizontal dots at the end of the row and then click Integration Options:


The Info window opens and your App ID and SDK information is displayed:


Step 5: Adding User Consent 


The General Data Protection Regulation of the European Union requires you to scope your user's consent. A user could be 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

We recommend that you consult with a legal advisor to determine the best approach for your business. It is also highly recommended to collect user consent with a certified Consent Management Platform (CMP).

For a full list of CMPs, click here.

Once you have collected the user’s consent, you can pass it onto the SDK using the following API:


     * Set the general data protection regulation user consent status
     * @param wasConsentGiven
    public static void setGdprConsent(boolean wasConsentGiven) {…}
    // Calling the consent method 

    * Set the general data protection regulation consent string
    * @param gdprConsent the consent string
    public static void setGdprConsentString(String gdprConsent) {…}

    // Calling the consent method 


GdprConsent 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.
GdprConsentString is a string.

If you don’t pass the user’s consent to the SDK, only contextual ads are shown to that user.

To clear the consent flag and consent data, the following API, use the following API:



It is highly recommended to use the 2nd option of passing a consent string per the IAB's Transparent & Consent Framework by using a valid CMP (Consent Management Platform). This is the most common form of consent communication worldwide and is crucial in order to enjoy ad monetization in the EU. Using the boolean option is inferior and is to be deprecated during 2020.

We recommend that the first time you gather the user’s consent, you pass it onto the SDK after starting the SDK but before requesting an ad. The SDK then takes the user’s consent into consideration when initializing. In the following sessions, you need only call the API if the user updates their consent.


When Fyber Marketplace is being mediated by MoPub, we recommend to set the GDPR flag directly on MoPub’s consent collection manager.

This manager forwards the consent state to the Fyber Marketplace and there is no additional requirement to explicitly set the GDPR flag on the Fyber Marketplace directly.

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


The intention of the California Consumer Privacy Act of 2018 (CCPA) is to protect the personal information of California residents. CCPA applies to all companies doing business in California. If a California resident uses an app developer’s mobile app, CCPA applies to the developer and every company that processes the personal information of the app’s users.
CCPA came into effect on 1 January 2020.

For more information on Fyber and CCPA, refer to Fyber’s Resource Page.
For more information about CCPA, refer to the IAB CCPA Compliance Framework.

If you choose to allow users to 'opt-out of the sale of their personal information' then you may use the following:

Once you have obtained a user response to an opt-out option, you can pass it to the SDK using the following API:


/*** Set the us privacy setting string     
* @param consentString a non empty String     
public static void setUSPrivacyConsent(String consentString) {…}

// Calling the consent method  		     
InneractiveAdManager.setUSPrivacyConsent("1YNN"); // This is an example value when the user chose NOT to 'opt-out'

To determine what value to use for the US Privacy String, refer to the IAB document here.
Example values:

  • When CCPA does not apply (for example if the user is not a resident of California) you can either skip this API or use the following value 1---
  • If the user choses NOT to opt out, and is ok with advertising as usual, you can use 1YNN
  • If the user chooses to restrict advertising and opt out, you can use 1YYN

To clear the privacy setting flag and opt-out data use the following API:

CCPA Clear Privacy Settings


Step 6: app-ads.txt

The simple app-ads.txt standard helps prevent the unauthorized selling of in-app inventory and app domain spoofing.

For details of listing your Developer Website URL in the Google Play Store, click here.

Step 7: Optional - Using the Fyber Marketplace SDK in Secure Only Mode (since version 7.2.1)


InneractiveAdManager.useSecureConnections(boolean useSecureConnnections)

This API described above allows you to control how should the SDK perform any and all network connections.

By invoking this setter with a value of true all outgoing network connections from the Fyber Marketplace SDK will be using ssl/https. The default behaviour is not to use secure connections.

Secure Demand Notice

By requesting secure only content, you potentially decrease the amount of demand which can be rendered by the SDK.


The Android application level secure API (network-security-config cleartextTrafficPermitted) takes precedence over this value - i.e. if you set cleartextTrafficPermitted to false and invoke the useSecureConnections setter with a value of false, the SDK behaves as if you requested secure only connections.