Getting Started with Android SDK Integration

Integrating and monetizing with InMobi SDK is easy. InMobi supports both manual download or mavenCentral to integrate the Android SDK.

Note

InMobi Android SDK repository is moved to mavenCentral since JCenter is deprecated and retired by Jfrog. For more information, see this blog.

Add the InMobi SDK

Option 1: Pulling the Latest SDK via mavenCentral

If you are using Gradle to build your Android applications, you can pull the latest version of the SDK from mavenCentral as described below:

  1. Include mavenCentral in your top-level build.gradle file:

    allprojects {
        repositories {
            mavenCentral()
        }
    }
    
  2. Add the following line to the dependencies element in your application module’s build.gradle.

    implementation 'com.inmobi.monetization:inmobi-ads:9.1.9'
    
  3. Sync your Gradle project to ensure that the dependency is downloaded by the build system.


Option 2: Adding the SDK Library to your Application Project

Alternatively, you can download the latest version of InMobi’s SDK here and copy the library to your application module’s libs/directory.

To add the library to your project’s dependencies, add this line to the dependencies element in your module’s build.gradle:

implementation fileTree(dir: 'libs', include: ['*.aar'])

Note

The latest version of InMobi SDK supports Android 4.1 (API level 16) or higher.

Add & Verify Dependencies 

To monetize with the InMobi SDK, you must add the following dependencies to your application module build.gradle:

Google Play Services

The InMobi SDK for Android needs the Google Play Services library to enable better ad targeting via the Google Play Advertising ID. Additionally, the SDK also uses the Google Play Services for getting a location fix, should the user consent to collecting their location.

To add the Google Play Services client library to your application:

  1. Add the following line to the application module’s dependency element.

    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.1.0'//optional dependency for better targeting
    	
  2. Sync your Gradle project to ensure that the dependencies are included.


Chrome Custom Tab

This is required to redirect the users to URLs outside InMobi WebView. To add the Chrome Custom library to your application:

  1. Add the following line to the application module's dependency element in the Gradle build script:

    implementation 'androidx.browser:browser:1.3.0'
    
  2. Sync your Gradle project to ensure dependencies are included.

Caution

Failure to include Chrome Custom Tab dependency in your application gradle scripts will cause ad requests to fail, thus affecting monetization of your app with the InMobi SDK.

Picasso Library

The InMobi SDK for Android uses the popular Picasso library for loading the ad assets. To add the Picasso library to your application:

  1. Add the following line to the application module’s dependency element in the Gradle build script:

    implementation 'com.squareup.picasso:picasso:2.71828'
    
  2. Sync your Gradle project to ensure that the dependencies are included.

Caution

Failure to include Picasso dependency in your application gradle scripts will cause interstitial ad requests to fail, thus affecting monetization of your app with the InMobi SDK.

Support Library 

For supporting paged scroll of a deck of images or ads, you must use support-v4 library

To add the Support Library to your application, add the following line to the application module’s dependency element in the Gradle build script. 

implementation 'com.android.support:support-v4:28.0.0'

RecyclerView

For supporting free scroll of a deck of images or ads, you must use RecyclerView. 

To add the RecyclerView library to your application, add the following line to the application module’s dependency element in the Gradle build script. 

implementation 'androidx.recyclerview:recyclerview:1.1.0'

Caution

Failure to include RecyclerView dependency in your application gradle scripts will cause interstitial ad requests to fail, thus affecting monetization of your app with the InMobi SDK.

Miscellaneous 

At times, including the InMobi SDK may cause the 64K limit on methods that can be packaged in an Android dex file to be breached. This can happen if, for example, your app packs a lot of features for your users and includes substantive code to realize this. 

If this happens, you can use the multidex support library to enable building your app correctly. To do this: 

  1. Modify the defaultConfig to mark your application as multidex enabled: 

    defaultConfig {
        ... 
        multiDexEnabled true // add this to enable multi-dex 
    } 
    	
  2. Add the following line to the dependencies element in your application module’s build script. 

    implementation 'androidx.multidex:multidex:2.0.1'
    


Now that you have added the dependencies, your app's build.gradle at this point will look like as shown below: 

dependencies {
    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.1.0' //optional dependency for better targeting
    implementation 'androidx.browser:browser:1.3.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
} 

Additional Configurations

Granting Permissions

It is highly recommended that you include ACCESS_FINE_LOCATION to enable better ad targeting. This is not a mandatory permission; however, including it will enable accurate ad targeting.

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

For further improved targeting, you can add the ACCESS_WIFI_STATE and CHANGE_WIFI_STATE permissions to the manifest.

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

Hardware Acceleration

Hardware acceleration allows you to display HTML5 video ads. To do this, add hardwareAccelerated:true element to the application tag.

<application 
    ... 
    android:hardwareAccelerated="true" 
    ... 
>

Proguard Configuration

Proguarding helps to remove unused symbols and reduce the final application footprint. The following proguard directives should be added to your application’s proguard configuration file:

-keepattributes SourceFile,LineNumberTable
-keep class com.inmobi.** { *; }
-keep public class com.google.android.gms.**
-dontwarn com.google.android.gms.**
-dontwarn com.squareup.picasso.**
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient{
     public *;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info{
     public *;
}
# skip the Picasso library classes
-keep class com.squareup.picasso.** {*;}
-dontwarn com.squareup.okhttp.**
# skip Moat classes
-keep class com.moat.** {*;}
-dontwarn com.moat.**
# skip IAB classes
-keep class com.iab.** {*;}
-dontwarn com.iab.**

Important Prerequisites

Let’s pause for some checks before we begin initializing the SDK:

Checkpoint: Preparing Your App for AndroidX

InMobi SDK is compatible with AndroidX (JetPack) library. In case your app uses the AndroidX library, InMobi SDK 9.1.7 or later is compliant with AndroidX.  Enabling the jetifier is not required for InMobi SDK. Check for any other dependencies requiring the enablement of the Jetifier before removing it. However, if you are using any version below 9.1.7, follow the standard guidelines by Google for migration by adding both the flags in build file.

android.useAndroidX=true
android.enableJetifier=true

It is highly recommended to upgrade Android Gradle plugin version to 4.1 or greater to avoid known issues in the jetifier which is fixed in the latest Gradle plugin version. To upgrade Android gradle plugin version please refer to Android developer documentation.

Initializing the SDK

Initialize the SDK using the init API by passing the context, InMobi account ID and the SdkInitialization listener in your launcher activity. Publishers can now check whether the init is successful or not with the completion callback. On completion of Init, any integration of ads should be taken care of. In case the listener is null, the SDK will start working with default settings and eventually gets updated settings later in the lifecycle of the app.

Remember

You must call this method on the UI thread. Not doing so will cause the initialization to fail and affect your application’s ability to monetize with InMobi.

JSONObject consentObject = new JSONObject();
try {
    // Provide correct consent value to sdk which is obtained by User 
    consentObject.put(InMobiSdk.IM_GDPR_CONSENT_AVAILABLE, true);
    // Provide 0 if GDPR is not applicable and 1 if applicable  
    consentObject.put("gdpr", "0");
    // Provide user consent in IAB format 
    consentObject.put(InMobiSdk.IM_GDPR_CONSENT_IAB, “ << consent in IAB format >> ”);
} catch (JSONException e) {
    e.printStackTrace();
}
InMobiSdk.init(this, "Insert InMobi Account ID here", consentObject, new SdkInitializationListener() {
    @Override
    public void onInitializationComplete(@Nullable Error error) {
        if (null != error) {
            Log.e(TAG, "InMobi Init failed -" + error.getMessage());
        } else {
            Log.d(TAG, "InMobi Init Successful");
        }
    }
});

Let’s understand a few things here before you proceed to the next step:

What is a consentObject? A consentObject is a JSONObject representation of all kind of consent provided by the publisher to the SDK. The key is mandatory if you wish to monetize traffic from European Economic Area; InMobi relies on publishers to obtain user consent to comply with the regulations. You can read further on GDPR regulations here.

Key Type Inference
gdpr_consent String A consent string is a series of numbers, which identifies the consent status of an Ad tech Vendor.

The string must follow the IAB contracts as mentioned here.

The key, gdpr_consent can be accessed via string constant IM_GDPR_CONSENT_IAB.

gdpr_consent_available boolean

true: Publisher has provided consent to collect and use user’s data.

false: - Publisher has not provided consent to collect and use user’s data.

Any value other than “true” and “false” is invalid and will be treated as value not provided by publisher, i.e. empty value.

The key gdpr_consent_available can be accessed via string constant IM_GDPR_CONSENT_AVAILABLE.

gdpr String Whether or not the request is subjected to GDPR regulations, deviation from the set values (0 = No, 1 = Yes ), indicate an unknown entity.

Note

  1. You need to provide consentObject in every session. The SDK does not persist consent, it only keeps the consentObject in memory. If the app is relaunched or crashes - SDK will lose the consentObject.
  2. Within a session, you can update the consent this way:

    InMobiSdk.updateGDPRConsent(JSONObject consentObject)	
    
  3. As part of the General Data Protection Regulation (“GDPR”) publishers who collect data on their apps, are required to have a legal basis for collecting and processing the personal data of users in the European Economic Area (“EEA”). Please ensure that you obtain appropriate consent from the user before making ad requests to InMobi for Europe and indicate the same by following our recommended SDK implementation. Please do not pass any demographics information of a user, if you do not have user consent from such user in Europe.

Optimization

A. Pass location signals to allow better ad targeting

Recommended

If your app collects location from the user, we recommend passing it up, as impressions with location signal have higher revenue potential. InMobi SDK will automatically pass the location signals if available in the app. If you use location in your app but would like to disable passing location signals to InMobi, then TURN OFF the “Location Automation” for your property on the InMobi dashboard.

Otherwise, you can pass the location signals as follows:

InMobiSdk.setLocation(locationObj);

Alternatively, you can set the city, state and country as well:

InMobiSdk.setLocationWithCityStateCountry(“city”,“state”,“country”);

B. Pass demographic signals to allow better ad targeting

InMobi relies on the publishers to obtain explicit consent from user for continuing business activities in EU as per GDPR. You can supply the InMobi SDK with the gender and age as follows:

InMobiSdk.setGender(InMobiSdk.Gender.MALE); // or InMobiSdk.Gender.FEMALE
InMobiSdk.setAge(age);
InMobiSdk.setAgeGroup(InMobiSdk.AgeGroup.BELOW_18);
   // other enums: BETWEEN_18_AND_20, BETWEEN_21_AND_24, BETWEEN_25_AND_34
   // BETWEEN_35_AND_5, ABOVE_55

Recommended

Passing location signals helps better ad targeting and ensures the ads served on your app are contextual and highly relevant to your users.

You are all set now! Let’s now have a look at how you can set up different ad formats and begin monetizing. Ready?

On This Page

Last Updated on: 26 Aug, 2021

Banner Ads

Set up a Banner Ad

  1. From the left navigation, select Inventory Inventory Settings.
  2. Search for the app or website you would like to create a placement for and click + Add a placement.
  3. Click Select Ad Unit and select Banner.
  4. Click Add a placement to start setting up your banner settings. After you create the banner placement, you can see the placement ID.

Add the Banner Ad to your App

Creating a Banner Ad

Option 1: Adding a Banner in XML layout resource files

You can add a banner ad in your layout resource file in XML and reference it in your code as you would in a regular view.

The following snippet shows how to add a banner ad in XML. Note the InMobi ads namespace that you need to add to the top-level layout element to add the banner.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.inmobi.ads" 
    xmlns:tools="http://schemas.android.com/tools"  
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
   ...  
   > 
  
    <com.inmobi.ads.InMobiBanner 
        android:layout_width="320dp" 
        android:layout_height="50dp" 
        android:id="@+id/banner" 
        ads:placementId="plid-1431977751489005" 
        ads:refreshInterval="60" 
    /> 
</LinearLayout>

For banner XML integration, publishers using Android SDK 720 and onwards needs to append “plid-” to placementId TAG as following:

ads:placementId="plid-1431977751489005"

Now, you can reference the banner in your code:

InMobiBanner bannerAd = (InMobiBanner)findViewById(R.id.banner);

Once you have the banner instance, you can request for ads to be loaded as shown in the following sections.

Before you do that, call the InMobiSdk.init(Context, String) method in your main activity or the activity where you are displaying banner ad to initialize the InMobi SDK.

Option 2: Adding a Banner in code

To add a banner ad in Android code, create an instance of InMobiBanner:

InMobiBanner bannerAd = new InMobiBanner(BannerAdsActivity.this, 1468078426600L); 

Note

  • The InMobiBanner class is not thread-safe. A banner instance must be created on the UI thread.
  • Similarly, all methods on this instance must be called on the UI thread. Not doing so will lead to unpredictable behavior and may affect your ability to monetize with InMobi.
  • Creating an InMobiBanner object before SDK initialization will throw an exception.

Once you have created a banner ad, you can add it to the view hierarchy:

RelativeLayout adContainer = (RelativeLayout) findViewById(R.id.ad_container);
RelativeLayout.LayoutParams bannerLp = new RelativeLayout.LayoutParams( < WIDTH_IN_PIXEL > , < HEIGHT_IN_PIXEL > );
bannerLp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
bannerLp.addRule(RelativeLayout.CENTER_HORIZONTAL);
adContainer.addView(bannerAd, bannerLayoutParams);

Note

  • You should specify the banner view dimensions in pixel units when setting the layout parameters for the banner ad.
  • Also, it is a programming error to supply WRAP_CONTENT as the layout parameters for a banner ad. This constraint applies whether you create a banner in your XML layout resource file or in code.
  • If you are building for both phones and tablets, you can supply MATCH_PARENT as the layout parameters for the banner. The InMobi SDK will correctly compute the banner view dimensions and use them to fetch an ad from the InMobi Network.

Loading a Banner Ad

Loading a banner ad requires you to add the banner ad view to your view hierarchy before requesting for an ad on the InMobiBanner instance. Adding the view to the view hierarchy enables the InMobi SDK to correctly compute the banner view dimensions and to request for the best ad matching those dimensions from the network.

Once you have added InMobiBanner to the view hierarchy, you can call the load() method on the instance you just created to request for an ad.

Optimization

Setting up Auto-refresh for your Banner Ad

The banner ads refresh automatically after the first time you requested for an ad by calling load() on an InMobiBanner instance. You can set up auto-refresh either while creating a banner in XML layout resource file, or later in code, by calling the setRefreshInterval(int) method on a banner ad.

The sample below shows how to do this in XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.inmobi.ads" 
    xmlns:tools="http://schemas.android.com/tools"  
android:layout_width="match_parent" 
    android:layout_height="match_parent"  
   ...
   >  
     
    <com.inmobi.ads.InMobiBanner 
        android:layout_width="320dp" 
        android:layout_height="50dp" 
        android:id="@+id/banner" 
        ads:placementId="plid-1431977751489005" 
ads:refreshInterval="60" 
    /> 
</LinearLayout>

Animating Banner Ad Refreshes

You can choose an animation style that takes effect when a banner is refreshed. You can also choose to turn OFF any animation for banner refreshes.

To do so, you can call the setAnimationType(InMobiBanner.AnimationType) method after obtaining a banner instance.

Note

The default animation is set to AnimationType.ROTATE_HORIZONTAL_AXIS. If you want to turn this off, call the setAnimationType method with the AnimationType.ANIMATION_OFF parameter.

Listening for Banner Ad Lifecycle Events

If you want to listen for key events in the banner lifecycle, you should implement the BannerAdListener interface. You can then set this listener using the setListener(BannerAdListener) method on the InMobiBanner instance. A brief description of each event is as follows.

/** 
 * A listener for receiving notifications during the lifecycle of a banner ad. 
 */
public abstract class BannerAdEventListener {
    /** 
     * Called to notify that an ad was received successfully but is not ready to be displayed yet. 
     * 
     * @param ad   Represents the ad which was loaded or preloaded 
     * @param info Represents the ad meta information 
     */
    public void onAdFetchSuccessful(@NonNull InMobiBanner ad, @NonNull AdMetaInfo info) {}
    /** 
     * Called to notify that an ad was successfully loaded. 
     * @param ad Represents the {@link InMobiBanner} ad which was loaded 
     * @param info Represents the ad meta information 
     */
    public void onAdLoadSucceeded(@NonNull InMobiBanner ad, @NonNull AdMetaInfo info) {}
    /** 
     * Called to notify that a request to load an ad failed. 
     * @param ad Represents the {@link InMobiBanner} ad which failed to load 
     * @param status Represents the {@link InMobiAdRequestStatus} status containing error reason 
     */
    public void onAdLoadFailed(@NonNull InMobiBanner ad, @NonNull InMobiAdRequestStatus status) {}
    /** 
     * Called to notify that the user interacted with the ad. 
     * @param ad Represents the {@link InMobiBanner} ad on which user clicked 
     * @param params Represents the click parameters 
     */
    public void onAdClicked(@NonNull InMobiBanner ad, Map < Object, Object > params) {}
    /** 
     * Called to notify that the banner ad was displayed 
     * @param ad Represents the {@link InMobiBanner} ad which was displayed 
     */
    public void onAdDisplayed(@NonNull InMobiBanner ad) {}
    /** 
     * Called to notify that the User is about to return to the application after closing the ad. 
     * @param ad Represents the {@link InMobiBanner} ad which was closed 
     */
    public void onAdDismissed(@NonNull InMobiBanner ad) {}
    /** 
     * Called to notify that the user is about to leave the application as a result of interacting with the ad. 
     * @param ad Represents the {@link InMobiBanner} ad 
     */
    public void onUserLeftApplication(@NonNull InMobiBanner ad) {}
    /** 
     * Called to notify that a reward was unlocked. 
     * @param ad Represents the {@link InMobiBanner} ad for which rewards was unlocked 
     * @param rewards Represents the rewards unlocked 
     */
    public void onRewardsUnlocked(@NonNull InMobiBanner ad, Map < Object, Object > rewards) {}
}

You can check the code samples for banner ad integrations on GitHub here.

Deprecating Banner

If you’re done with the Banner object, then simply call deprecate on the same to release the resources. This will do the following:

  1. Remove the ad-view from the view hierarchy.
  2. Cancel any ongoing refresh.
  3. De-reference the listeners.
  4. Other clean-ups.
bannerAd.destroy(); // bannerAd is an example instance.

On This Page

Last Updated on: 26 Aug, 2021

Interstitial Ads

We support both static and video interstitial ads. Follow the instructions below to set up interstitial ads.

Set up Interstitial Ad

  1. From the left navigation, select Inventory Inventory Settings.
  2. Search for the app or website you would like to create a placement for and click + Add a placement.
  3. Click Select Ad Unit and select Interstitial.
  4. Click Add a placement to start setting up your Interstitial settings.
  5. From there you can select your Ad Experience template. If you haven’t created an Ad Experience template yet, you can select the default Interstitial ad template created by InMobi which can contain both static and video creatives. You can always create your own template from Inventory Ad Experience Template. For more information, see Ad Experience Settings. After you create the Interstitial placement, you can see the placement ID.

Add Interstitial Ad to your App

Creating Interstitial Ad

To create an interstitial ad, create an instance of an InMobiInterstitial:

InMobiInterstitial interstitialAd = new InMobiInterstitial(InterstitialAdsActivity.this, 1471550843414L, 
mInterstitialAdEventListener);

Here, mInterstitialAdEventListener is an implementation of the InterstitialAdEventListener Abstract class. It is mandatory to supply an implementation of this abstract class to create an interstitial ad.

Warning

  • The InMobiInterstitial class is not thread-safe. An interstitial instance must be created on the UI thread.
  • Similarly, all methods on this instance must be called on the UI thread. Not doing so will lead to unpredictable behavior and may affect your ability to monetize with InMobi.
  • Creating an InMobi Interstitial object without SDK Initialization will throw an exception.

InterstitialAdEventListener abstract class allows you to listen to key lifecycle events for an interstitial ad. You should listen to these events to ensure that your application correctly handles the various lifecycle transitions.

/** 
 * Listener for receiving notifications during the lifecycle of an interstitial. 
 */
public abstract class InterstitialAdEventListener {
    /** 
     * Called to indicate that an ad was loaded and it can now be shown. This will always be called 
     * after the {@link #onAdFetchSuccessful(InMobiInterstitial, AdMetaInfo)} callback. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which was loaded 
     * @param info Represents the ad meta information 
     */
    public void onAdLoadSucceeded(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info) {}
    /** 
     * Callback to signal that a request to fetch an ad (by calling 
     * {@link InMobiInterstitial#load()} failed. The status code indicating the reason for failure 
     * is available as a parameter. You should call {@link InMobiInterstitial#load()} again to 
     * request a fresh ad. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which failed to load 
     * @param status Represents the {@link InMobiAdRequestStatus} status containing error reason 
     */
    public void onAdLoadFailed(@NonNull InMobiInterstitial ad, @NonNull InMobiAdRequestStatus status) {}
    /** 
     * Called to indicate that an ad is available in response to a request for an ad (by calling 
     * {@link InMobiInterstitial#load()}. Note: This does not 
     * indicate that the ad can be shown yet. Your code should show an ad after the 
     * {@link #onAdLoadSucceeded(InMobiInterstitial)} method is called. Alternately, if you do not 
     * want to handle this event, you must test if the ad is ready to be shown by checking the 
     * result of calling the {@link InMobiInterstitial#isReady()} method. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad for which ad content was received 
     * @param info Represents the ad meta information 
     */
    public void onAdFetchSuccessful(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info) {}
    /** 
     * Called to indicate that an ad interaction was observed. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad on which user clicked 
     * @param params Represents the click parameters 
     */
    public void onAdClicked(@NonNull InMobiInterstitial ad, Map < Object, Object > params) {}
    /** 
     * Called to indicate that the ad will be launching a fullscreen overlay. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which will display 
     */
    public void onAdWillDisplay(@NonNull InMobiInterstitial ad) {}
    /** 
     * Called to indicate that the fullscreen overlay is now the topmost screen. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which is displayed 
     * @param info Represents the ad meta information 
     */
    public void onAdDisplayed(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info) {}
    /** 
     * Called to indicate that a request to show an ad (by calling {@link InMobiInterstitial#show()} 
     * failed. You should call {@link InMobiInterstitial#load()} to request for a fresh ad. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which failed to show 
     */
    public void onAdDisplayFailed(@NonNull InMobiInterstitial ad) {}
    /** 
     * Called to indicate that the fullscreen overlay opened by the ad was closed. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which was dismissed 
     */
    public void onAdDismissed(@NonNull InMobiInterstitial ad) {}
    /** 
     * Called to indicate that the user may leave the application on account of interacting with the ad. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad 
     */
    public void onUserLeftApplication(@NonNull InMobiInterstitial ad) {}
    /** 
     * Called to indicate that rewards have been unlocked. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad for which rewards was unlocked 
     * @param rewards Represents the rewards unlocked 
     */
    public void onRewardsUnlocked(@NonNull InMobiInterstitial ad, Map < Object, Object > rewards) {}
}

Loading an Interstitial Ad

To request for an interstitial ad, call the load() method on the InMobiInterstitial instance:

interstitialAd.load();

InterstitialAdEventListener abstract class notifies the result of this method. If the ad request was successful, the onAdFetchSuccessful(InMobiInterstitial, AdMetaInfo) event is generated. This is followed by either the onAdLoadSucceeded or the onAdLoadFailed event.

If the onAdLoadFailed event is generated, the reason is indicated by the InMobiAdRequestStatus object passed in this event.

If the onAdLoadSucceeded event is generated, you can show the ad anytime after this by calling show() on the InMobiInterstitial instance.

Note

Calling load() on the same interstitial ad after the onAdLoadSucceeded event is generated by the SDK is not guaranteed to request a fresh ad from the network. A fresh ad will only be fetched if either the previous ad was discarded by the SDK, or if the ad expired or the user cleared application data and caches.


Showing an Interstitial Ad

To show an interstitial ad, call show() on the InMobiInterstitial instance anytime after the onAdLoadSucceeded event has been generated by the SDK. The code fragment below illustrates the same.

InMobiInterstitial interstitialAd;
InterstitialAdEventListener mInterstitialAdEventListener = new InterstitialAdEventListener() {
    // implementation for other events 
    // onAdFetchSuccessful, onAdLoadFailed, etc 
    @Override
    public void onAdLoadSucceeded(@NonNull InMobiInterstitial inMobiInterstitial, @NonNull AdMetaInfo info) {
        Log.d(TAG, "Ad can now be shown!");
        mCanShowAd = true;
    }
};
void init() {
    InMobiInterstitial interstitialAd = new InMobiInterstitial(GameActivity.this, 1471550843414 L, mInterstitialAdEventListener);
}
void prepareGameLevel() {
    interstitialAd.load();
}
void handleGameLevelCompleted() {
    If(mCanShowAd) interstitialAd.show();
}

Your application will be notified of the result of this request via the InterstitialAdEventListener abstract class.

If the ad can be shown, the SDK will notify your code by calling on the onAdWillDisplay interface, followed by calling the onAdDisplayed method when the ad is actually presented on the screen.

If the ad cannot be displayed, the onAdDisplayFailed event is generated by the SDK to let your application know that the ad could not be displayed. You can request for a fresh ad by calling load() again to handle this event.

When an interstitial ad is dismissed, your application will be notified in the onAdDismissed callback.

You can check the code samples for interstitial ad integrations on GitHub here.

On This Page

Last Updated on: 26 Aug, 2021

In Stream Video Ads

Set up In-Stream Video Ad

  1. From the left navigation panel, select Inventory Inventory Settings.
  2. Search for the app or website you would like to create a placement for and click + Add a placement.
  3. Click Select Ad Unit and select In-Stream Video.
  4. Click Add a placement to start setting up your in-stream video settings. After you create the rewarded video placement, you can see the placement ID.

Note

InMobi SDK provides you the callback in any case, so you could choose not to fill in anything and handle the rewards completely at your end.

Add In-Stream Video Ad to your App

Creating a Rewarded Video Ad

For more information on how to create the in-stream video ad, see.

On This Page

Last Updated on: 26 Aug, 2021

Rewarded Video Ads

Set up a Rewarded Video Ad

  1. From the left navigation select Inventory Inventory Settings.
  2. Search for the app or website you would like to create a placement for and click + Add a placement.
  3. Click Select Ad Unit and select Rewarded Video.
  4. Click Add a placement to start setting up your rewarded video settings. After you create the rewarded video placement, you can see the placement ID.

Important

InMobi SDK provides you the callback in any case, so you could choose not to fill in anything and handle the rewards completely at your end.


Add Rewarded Video Ad to your App

Creating a Rewarded Video Ad

To create a rewarded video ad, create an instance of an InMobiInterstitial:

InMobiInterstitial interstitialAd = new InMobiInterstitial(InterstitialAdsActivity.this, 1471550843414L, 
mInterstitialAdEventListener);

Here, mInterstitialAdEventListener is an implementation of the InterstitialAdEventListener abstract class. It is mandatory to supply an implementation of this interface to create an interstitial ad.

Note

  • The InMobiInterstitial class is not thread-safe. An interstitial instance must be created on the UI thread.
  • Similarly, all methods on this instance must be called on the UI thread. Not doing so will lead to unpredictable behavior and may affect your ability to monetize with InMobi.
  • Creating an InMobiInterstitial object without SDK Initialization will throw an exception.

The InterstitialAdEventListener abstract class allows you to listen to key lifecycle events for an interstitial ad. You should listen to these events to ensure that your application correctly handles the various lifecycle transitions.

/** 
 * Listener for receiving notifications during the lifecycle of an interstitial. 
 */
public abstract class InterstitialAdEventListener {
    /** 
     * Called to indicate that an ad was loaded and it can now be shown. This will always be called 
     * after the {@link #onAdFetchSuccessful(InMobiInterstitial, AdMetaInfo)} callback. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which was loaded 
     * @param info Represents the ad meta information 
     */
    public void onAdLoadSucceeded(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info) {}
    /** 
     * Callback to signal that a request to fetch an ad (by calling 
     * {@link InMobiInterstitial#load()} failed. The status code indicating the reason for failure 
     * is available as a parameter. You should call {@link InMobiInterstitial#load()} again to 
     * request a fresh ad. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which failed to load 
     * @param status Represents the {@link InMobiAdRequestStatus} status containing error reason 
     */
    public void onAdLoadFailed(@NonNull InMobiInterstitial ad, InMobiAdRequestStatus status) {}
    /** 
     * Called to indicate that an ad is available in response to a request for an ad (by calling 
     * {@link InMobiInterstitial#load()}.Note: This does not 
     * indicate that the ad can be shown yet. Your code should show an ad after the 
     * {@link #onAdLoadSucceeded(InMobiInterstitial)} method is called. Alternately, if you do not 
     * want to handle this event, you must test if the ad is ready to be shown by checking the 
     * result of calling the {@link InMobiInterstitial#isReady()} method. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad for which ad content was received 
     * @param info Represents the ad meta information 
     */
    public void onAdFetchSuccessful(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info) {}
    /** 
     * Called to indicate that an ad interaction was observed. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad on which user clicked 
     * @param params Represents the click parameters 
     */
    public void onAdClicked(@NonNull InMobiInterstitial ad, Map < Object, Object > params) {}
    /** 
     * Called to indicate that the ad will be launching a fullscreen overlay. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which will display 
     */
    public void onAdWillDisplay(@NonNull InMobiInterstitial ad) {}
    /** 
     * Called to indicate that the fullscreen overlay is now the topmost screen. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which is displayed 
     * @param info Represents the ad meta information 
     */
    public void onAdDisplayed(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info) {}
    /** 
     * Called to indicate that a request to show an ad (by calling {@link InMobiInterstitial#show()} 
     * failed. You should call {@link InMobiInterstitial#load()} to request for a fresh ad. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which failed to show 
     */
    public void onAdDisplayFailed(@NonNull InMobiInterstitial ad) {}
    /** 
     * Called to indicate that the fullscreen overlay opened by the ad was closed. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad which was dismissed 
     */
    public void onAdDismissed(@NonNull InMobiInterstitial ad) {}
    /** 
     * Called to indicate that the user may leave the application on account of interacting with the ad. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad 
     */
    public void onUserLeftApplication(@NonNull InMobiInterstitial ad) {}
    /** 
     * Called to indicate that rewards have been unlocked. 
     * 
     * @param ad Represents the {@link InMobiInterstitial} ad for which rewards was unlocked 
     * @param rewards Represents the rewards unlocked 
     */
    public void onRewardsUnlocked(@NonNull InMobiInterstitial ad, Map < Object, Object > rewards) {}
}


Loading a Rewarded Ad

To request for a interstitial ad, call the load() method on the InMobiInterstitial instance:

interstitialAd.load();

You will be notified of the result of this method via the InterstitialAdEventListener event interface. If the ad request was successful, the onAdFetchSuccessful(InMobiInterstitial, AdMetaInfo) event will be generated. This will be followed by either the onAdLoadSucceeded or the onAdLoadFailed event. If the onAdLoadFailed event is generated, the reason is indicated by the InMobiAdRequestStatus object passed in this event. If the onAdLoadSucceeded event is generated, you may now show the ad anytime after this by calling show() on the InMobiInterstitial instance.

Note

Calling load() on the same interstitial ad after the onAdLoadSucceeded event is generated by the SDK is not guaranteed to request a fresh ad from the network. A fresh ad will only be fetched if either the previous ad was discarded by the SDK, or if the ad expired or the user cleared application data and caches.


Showing a Rewarded Video Ad

To show a rewarded video ad, just call show() on the InMobiInterstitial instance anytime after the onAdLoadSucceeded event has been generated by the SDK. The code fragment below illustrates this:

InMobiInterstitial interstitialAd;
InterstitialAdEventListener mInterstitialAdEventListener = new InterstitialAdEventListener() {
    // implementation for other events 
    // onAdFetchSuccessful, onAdLoaFailed, etc 
    @Override
    public void onAdLoadSucceeded(@NonNull InMobiInterstitial inMobiInterstitial, @NonNull AdMetaInfo info) {
        Log.d(TAG, "Ad can now be shown!");
        mCanShowAd = true;
    }
};
void init() {
    interstitialAd = new InMobiInterstitial(GameActivity.this, 1471550843414 L, mInterstitialAdEventListener);
}
void prepareGameLevel() {
    interstitialAd.load();
}
void handleGameLevelCompleted() {
    If(mCanShowAd) interstitialAd.show();
}

Your application will be notified of the result of this request via the InterstitialAdEventListener’s callbacks. If the ad can be shown, then the SDK will notify your code by calling on the onAdWillDisplay interface, followed by calling the onAdDisplayed method when the ad is actually presented on the screen. If the ad cannot be displayed, the onAdDisplayFailed event is generated by the SDK to let your application know that the ad could not be displayed. You can request for a fresh ad by calling load() again to handle this event.

When an interstitial ad is dismissed, your application will be notified in the onAdDismissed callback.


Implementing the Callback for Rewards

For rewarded video ads, the SDK will generate the onAdRewardActionCompleted event, passing the meta data you configured on the InMobi support portal. You can handle this event like so:

  InterstitialAdEventListener mInterstitialAdEventListener = new InterstitialAdEventListener() {
    // implementation for other events 
    // onAdLoadSucceeded, onAdDisplayed, etc 
    @Override
    public void onRewardsUnlocked(@NonNull InMobiInterstitial inMobiInterstitial, Map < Object, Object > map) {
        Log.d(TAG, "Ad rewards unlocked!");
        for (Object key: map.keySet()) {
            Object value = map.get(key);
            Log.v(TAG, "Unlocked " + value + " " + key);
        }
    }
};

You can check the code samples for interstitial ad integrations on GitHub here.

On This Page

Last Updated on: 26 Aug, 2021

Native Ads

InMobi Native Ads support both static and video ads. You can opt for In-Feed, Splash, or Pre-Roll formats. The steps for creating a native ad placement are given below.

Set up Native Ad

InMobi Native Ads support both static and video ads. You can opt for In-Feed, Splash , or Pre-Roll formats. The steps for creating a native ad placement are given below.

  1. From the left navigation, select Inventory Inventory Settings.
  2. Search for the app or website you would like to create a placement for and click + Add a placement.
  3. Click Select Ad Unit and select Native.
  4. Click Add a placement to start setting up your Native settings.
  5. From there you can select your Ad Experience template. If you haven’t created an Ad Experience template yet, you can select the default Interstitial ad template created by InMobi which can contain both static and video creatives. The default setting is an in-Feed ad layout, with an aspect ratio ranging between 256:135 - 1200x627.

You can always create your own native template by going to Inventory Ad Experience Template and select your chosen ad layout. For more information on Ad Experience Templates, see Ad Experience Settings.

Once the native placement is created, you will be able to see the placement ID.

 

Add Native Ad to your App

Creating a Native Ad

To create a native ad, create an InMobiNative instance:

public class NativeAdsActivity extends Activity { 
    …………………… 
    private final List<InMobiNative> mNativeAds = new ArrayList<>(); 
    …………………… 
    InMobiNative nativeAd = new InMobiNative(NativeAdsActivity.this, YOUR_PLACEMENT_ID, nativeAdEventListener); 
    nativeAd.load(); 
    mNativeAds.add(nativeAd); 
    …………………… 
}

Here nativeAdEventListener is an implementation of the NativeAdEventListener abstract class. It is mandatory to supply an implementation of this interface to create a native ad. Creating an InMobiNative object without SDK Initialization will throw an exception.

Mandatory

You must supply a Context implementation to the InMobiNative constructor. Please make sure your implementation holds a strong reference of InMobiNative otherwise you will not be able to get any callback from SDK for this reference. This can be achieved by making it a member variable of a class or storing it in the collection, which lives through your application life cycle.

  • inMobiNative should always be a strong reference otherwise, you may not receive any callback (load success, load failure, etc.) for this reference.
  • If inMobiNative is referenced by any variable please ensure that it is a strong reference.
  • Use the android profiler to ensure that inMobiNative is not removed due to garbage collection.

NativeAdEventListener abstract class allows you to listen to key lifecycle events for a native ad.

/** 
 * A listener for receiving notifications during the lifecycle of a Native ad. 
 */
public abstract class NativeAdEventListener {
    /** 
     * Called to indicate that an ad is available in response to a request for an ad (by calling 
     * {@link InMobiNative#load()}. Note: This does not 
     * indicate that the ad can be shown yet. Your code should show an ad after the 
     * {@link #onAdLoadSucceeded(InMobiNative)} method is called. Alternately, if you do not 
     * want to handle this event, you must test if the ad is ready to be shown by checking the 
     * result of calling the {@link InMobiNative#isReady()} method.
     * 
     * @param ad Represents the {@link InMobiNative} ad for which ad content was received 
     */
    public void onAdReceived(InMobiNative ad) {}
    /** 
     * Called to indicate that an ad was loaded and it can now be shown. This will always be called 
     * after the {@link #onAdReceived(InMobiNative)} callback. 
     * 
     * @param ad Represents the {@link InMobiNative} ad which was loaded 
     */
    public void onAdLoadSucceeded(InMobiNative ad) {}
    /** 
     * Called to notify that a native ad failed to load. 
     * 
     * @param ad  Represents the {@link InMobiNative} ad which failed to load 
     * @param requestStatus Represents the {@link InMobiAdRequestStatus} status containing error reason 
     */
    public void onAdLoadFailed(InMobiNative ad, InMobiAdRequestStatus requestStatus) {}
    /** 
     * 
     * @param ad  Represents the {@link InMobiNative} ad whose fullscreen was dismissed 
     */
    public void onAdFullScreenDismissed(InMobiNative ad) {}
    /** 
     * Called to notify that the ad will open an overlay that covers the screen. 
     * 
     * @param ad Represents the {@link InMobiNative} ad which will go fullscreen 
     */
    public void onAdFullScreenWillDisplay(InMobiNative ad) {}
    /** 
     * Called to notify that the ad opened an overlay that covers the screen. 
     * 
     * @param ad Represents the {@link InMobiNative} ad whose fullscreen will be displayed 
     */
    public void onAdFullScreenDisplayed(InMobiNative ad) {}
    /** 
     * Called to notify that the user is about to leave the application as a result of interacting with it. 
     * 
     * @param ad Represents the {@link InMobiNative} ad 
     */
    public void onUserWillLeaveApplication(InMobiNative ad) {}
    /** 
     * Called to notify impression has been recorded for this ad. Note:Override this method to notify 
     * viewable impression to the Mediation Adapter. 
     * 
     * @param ad Represents the {@link InMobiNative} ad for which impression is recorded. 
     */
    public void onAdImpressed(InMobiNative ad) {}
    /** 
     * Called to notify ad was clicked. Note:Override this method to notify click to the Mediation Adapter. 
     * 
     * @param ad Represents the {@link InMobiNative} ad which was clicked 
     */
    public void onAdClicked(InMobiNative ad) {}
    /** 
     * Called to notify that the ad status has changed. 
     * 
     * @param nativeAd Represents the {@link InMobiNative} ad 
     */
    public void onAdStatusChanged(InMobiNative nativeAd) {}
}

VideoEventListener abstract class allows you to listen to video lifecycle events for a native ad.

/** 
 * A listener for receiving notifications during the lifecycle of a Native ad. 
 */
public abstract class VideoEventListener {
    /** 
     * Called to notify that the video has finished playing. 
     * 
     * @param ad Represents the {@link InMobiNative} ad 
     */
    public void onVideoCompleted(InMobiNative ad) {}
    /** 
     * Called to notify that the user has skipped video play. 
     * 
     * @param ad Represents the {@link InMobiNative} ad 
     */
    public void onVideoSkipped(InMobiNative ad) {}
    /** 
     * Called to notify when media audio state changes. 
     * 
     * @param isMuted Represents whether media is muted or not. 
     */
    public void onAudioStateChanged(InMobiNative inMobiNative, boolean isMuted) {}
}

Loading Native Ad

To request for a native ad, call the load() method on the InMobiNative instance you created above:

nativeAd.load(); 

The NativeAdEventListener abstract class notifies the result of this method. If the ad request was successful, the onAdReceived(InMobiNative) event is generated. This is followed by either the onAdLoadSucceeded or the onAdLoadFailed event. If the onAdLoadFailed event is generated, the reason is indicated by the InMobiAdRequestStatus object passed in this event.


Listening to video events

To receive video events register videoEventListener using method setVideoEventListener (VideoEventListener videoEventListener) on the InMobiNative instance you created above:

nativeAd.setVideoEventListener (videoEventListener);

The VideoEventListener abstract class notifies you about video events for native ads.

Native Ad APIs

Following are the important APIs in InMobiNative that will help to stitch the ads:

  • View getPrimaryViewOfWidth(context, convertView, parent, width) - Returns a View of specified width (specified in actual pixels). This is the main ad content in your native ad. It will return a view of the same aspect ratio that you selected on the InMobi dashboard while creating the native placement. All impression render events are also fired automatically when this primary view is displayed on the screen.

    If you have selected Feed Layout while creating your placement, specify width = 25 while fetching your primaryView. It will just show the AdChoices icon and fire the ad render events.

    getPrimaryViewOfWidth(..) takes in four parameters:

    • context - The context in which ad is going to be rendered.
    • convertView - This is the complete view of a row of the ListView. You should not provide this as NULL because we use this parameter to recycle our ads effectively. This will allow for a smooth scroll performance.
    • parentView - This is the parent view inside which you will place the primaryView (which is returned by getPrimaryViewOfWidth() function). We need it for determining the layout parameters of Primary View.
    • adViewWidthInPixels - This is the width (in pixels) that you want the primaryView to take up.
  • String getAdTitle() - returns the string title for the ad.
  • String getAdDescription() - returns the string description for the ad.
  • String getAdIconUrl() - returns icon Image String URL for the ad.
  • String getAdCtaText() - returns Click to action string for the ad.
  • String getAdRating() - returns rating for the ad (optional).
  • String getAdLandingPageUrl() - returns landing URL for the ad.
  • boolean isAppDownload - returns true when the featured ad is from an app install advertiser.
  • boolean isReady() - True means the ad is ready to be displayed.
  • Boolean isVideo() - returns a Boolean if the ad returned contains a video or not, returns null if it is called in a wrong state.
  • void reportAdClickAndOpenLandingPage() - This function fires the click events and opens the landing page. You need not open landing page on your own while using this function.
  • JSONObject getCustomAdContent() - This function returns the JSONObject. This json have additional information (description, image URL, etc.), which can be used to create custom UI around the primary view of the ad.

Stitching a Native Ad

A native ad can be stitched in your app in three formats:

  • In-Feed ads
  • Splash ads
  • Pre-Roll ads

In-Feed Ad Integration

  1. Declare an ad position in your feed where you want to show ad.

    For example, to show ad at 4th position:

    private static final int AD_POSITION = 4; 
  2. If the ad load is successful, you will get a callback onAdLoadSucceeded(InMobiNative).You should then add the InMobiNativeAd object to your data source within this listener. If your feed in the app is a ListView, a sample implementation for ListView is shown below:

    @Override
    public void onAdLoadSucceeded(@NonNull InMobiNative nativeAd) {
        AdFeedItem nativeAdFeedItem = new AdFeedItem(nativeAd);
        mFeedItems.add(AD_POSITION, nativeAdFeedItem);
        mFeedAdapter.notifyDataSetChanged();
    }
    

    In the step above, AdFeedItem is an extension class of your FeedItem class, where FeedItem is the class which powers each row of your ListView. Also mItems is the ArrayList, which powers the Adapter of this ListView.
  3. So far, we have loaded an ad and added it to your data source. Now, it’s time to display the ad. The sample implementation for ListView is as follows:

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final int itemViewType = getItemViewType(position);
        if (itemViewType == VIEW_TYPE_CONTENT_FEED) {
            //Your app code 
        } else {
            //Since this content type is InMobi Ad, you need to get native Ad view 
            final InMobiNative nativeAd = ((AdFeedItem) feedItem).mNativeAd;
            View primaryView = nativeAd.getPrimaryViewOfWidth(context, convertView, parent, parent.getWidth());
            if (convertView == null) {
                convertView = mLayoutInflater.inflate(R.layout.ad_item, parent, false);
            }
            ((RelativeLayout) convertView.findViewById(R.id.primaryView)).addView(primaryView);
            ((TextView) convertView.findViewById(R.id.title)).setText(nativeAd.getTitle());
            ((TextView) convertView.findViewById(R.id.desc)).setText(nativeAd.getDescription());
            ((TextView) convertView.findViewById(R.id.cta)).setText(nativeAd.getCtaText());
            return convertView;
        }
    }
    

    The function getItemViewType(position) checks whether the content type is FEED OR AD as given below:

    @Override
    public int getItemViewType(int position) {
        FeedItem feedItem = getItem(position);
        if (feedItem instanceof AdFeedItem) {
            return VIEW_TYPE_INMOBI_STRAND;
        }
        return VIEW_TYPE_CONTENT_FEED;
    }
    

    We have used some of the APIs described in the section above to show the title, description, and CTA text of the ad. Similarly, the other APIs can be used to show the corresponding parts of the ad.


Splash Integration

Splash experience can be implemented using the same InMobiNative class. However, there are a few things to be noted:

  • You should use InMobiNativeAd.isReady() function to determine if the ad is ready to be shown. Sometimes, your main thread may be occupied and hence you may not receive onAdLoadSucceeded in time. Hence, it is better to proactively check if the ad is ready just after your cut-off time has elapsed.
  • IMPORTANT: You should NOT destroy or refresh the ad if the second screen of the ad is in display. You can check this in the onAdFullScreenDisplayed and not dismiss the ad if this callback is fired.

Sample implementation is as follows:

@Override
public void onAdFullScreenDisplayed(InMobiNative nativeAd) {
    isSecondScreenDisplayed = YES;
}
public void dismissAd() {
    if (isSecondScreenDisplayed) {
        Log.d(TAG, "DO NOT DISMISS THE AD WHILE THE SCREEN IS BEING DISPLAYED");
    } else {
        splashAdView.setVisibility(View.GONE);
        nativeAd.destroy();
    }
}

Pre-Roll Integration

Pre-Roll Video experience can be implemented using the same InMobiNative Class. You need to register videoEventListener and need to dismiss the ad view in the following callback:

@Override 
public void onVideoCompleted(@NonNull InMobiNative nativeAd) { 
    Log.d (TAG, "Media playback complete " + mPosition); 
}

The Pre-Roll ad can be dismissed as follows:

public void dismissAd() { 
    plashAdView.setVisibility(View.GONE); 
    nativeAd.destroy(); 
}

Refreshing Native Ad

You will need to refresh the ad at various points to optimize ad exposure to your users. To refresh the ad, you will need to call the following functions in the exact order.

Note

It is important to remove the adFeedItem object from your data source and destroying it before refreshing. You will then need to create a new object and call load as shown in the following code:

private void refreshAd() {
    Iterator < FeedItems > feedItemIterator = mFeedItems.iterator();
    while (feedItemIterator.hasNext()) {
        final FeedItem feedItem = feedItemIterator.next();
        if (feedItem instanceof AdFeedItem) {
            feedItemIterator.remove();
        }
    }

    // refresh feed 
    mFeedAdapter.notifyDataSetChanged();
    // destroy InMobiNative object 
    inMobiNativeAd.destroy();
    // create InMobiNative object again 
    InMobiNative inMobiNativeAd = new InMobiNative( 
        << Activity Instance >> , 
        << Your Placement ID >> , 
        << InMobiNativeAdListener created in step 1 >> );
    inMobiNativeAd.load();
}

Managing the InMobiNative Instances

  1. Every instance of InMobiNative represents exactly one ad.
  2. If you want to place ad at multiple positions within a content feed, create as many instances of InMobiNative as the number of ad positions.
  3. You should create instances of InMobiNative in onCreate() callback of Activity or in onActivityCreated() callback of Fragment.
  4. You should destroy the InMobiNative instances in onDestroy() callback of Activity or in OnDestroyView() callback of Fragment.
  5. An InMobiNativeAd object must always be destroyed once you remove it from the data source. All user interactions with the ad view will not be honored after InMobiNativeAd is destroyed. So, you will have to definitely discard the ad view before destroying the InMobiNativeAd.
  6. All InMobiNativeAd instances must also be destroyed, when the component hosting them (your activity in this case) is getting destroyed using the destroy() API.

Click Tracking on the Ad Views

To have the InMobi SDK open the landing URL in addition to reporting a click, call the reportAdClickAndOpenLandingPage() method on the native ad instance:

nativeAd.reportAdClickAndOpenLandingPage(); 

Implementing Backfill

InMobi's SDK can run both HTML and native units against your native placement. You can run the following ad sizes depending on the real-estate reserved for your native placement.

  • 320x50 HTML Banner
  • 300x250 HTML Banner
  • 320x480 HTML Full screen Banner
  • 320x568 HTML Full screen Banner

To switch this on, you need to reach out to your respective partner manager with the preferred backfill size. Also, you will need to handle this in your code as follows:

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final int itemViewType = getItemViewType(position);
    if (itemViewType == VIEW_TYPE_CONTENT_FEED) {
        //Your app code 
    } else {
        //Since this content type is InMobi Ad, you need to get native Ad view 
        final InMobiNative nativeAd = ((AdFeedItem) feedItem).mNativeAd;
        //Detect whether its a backfill response or normal native 
        JSONObject customContent = currentNativeAd.getCustomAdContent();
        boolean isBackFillBanner = false;
        try {
            isBackFillBanner = customContent.getBoolean("isHTMLResponse");
        } catch (JSONException e) {
            isBackFillBanner = false;
        }
        if (isBackFillBanner) {
            View primaryView = nativeAd.getPrimaryViewOfWidth(context, convertView, parent, Math.round(getResources().getDisplayMetrics().density * 250));
            if (convertView == null) {
                convertView = mLayoutInflater.inflate(R.layout.ad_item, parent, false);
            }
            ((RelativeLayout) convertView.findViewById(R.id.primaryView)).addView(primaryView);
            return convertView;
        } else {
            View primaryView = nativeAd.getPrimaryViewOfWidth(context, convertView, parent, parent.getWidth());
            if (convertView == null) {
                convertView = mLayoutInflater.inflate(R.layout.ad_item, parent, false);
            }
            ((RelativeLayout) convertView.findViewById(R.id.primaryView)).addView(primaryView);
            ((TextView) convertView.findViewById(R.id.title)).setText(nativeAd.getTitle());
            ((TextView) convertView.findViewById(R.id.desc)).setText(nativeAd.getDescription());
            ((TextView) convertView.findViewById(R.id.cta)).setText(nativeAd.getCtaText());
            return convertView;
        }
    }
}

Note

  • To detect if the response is backfill, the customAdContent will contain the string isHTMLResponse.
  • Do NOT scale the width of the HTML banner response. For e.g. if you selected backfill of 300x250, make sure the provided width is hardcoded 250.
  • Do NOT add the CTA button in case of backfill response. The clicks will not be monetized in case you add this button alongside the ad.

On This Page

Last Updated on: 26 Aug, 2021

Testing and Troubleshooting

Retrieve the CreativeID

It may happen that some advertisers escape ad quality checks and end up compromising the user experience on the app by showcasing either an irrelevant, distasteful, or disrupting creative to the user. To combat such situations, you can retrieve the creativeID of the ad instance and report back to your InMobi point of contact with the encrypted creativeID. CreativeID is a property of IMBanner, IMInterstitial and IMNative object, which can be retrieved as follow:

public void onAdLoadSucceeded(@NonNull <inmobi_ad_object> ad, @NonNull AdMetaInfo info) { Log.d(TAG, “Creative ID for ad : “ + info.getCreativeID()); }</inmobi_ad_object>

Test Your Integration

You can start testing your integration by navigating to the Integration Tab on the InMobi Publisher Dashboard.

If you have Java and Python installed in your local system, click here and run the Library Detection Tool to ensure that all the mandatory libraries are needed for InMobi SDK integration [InMobi SDK, Picasso, browser, and RecyclerView] are available.

To set up a test device, you will need the corresponding device ID. The device id is the Google Play Advertising ID (GPID). To get the device ID, configure the SDK to print debug logs to the console.

Remember

You MUST turn off the test mode before going live or else your app will fail to monetize.
 

        3. If you have Java and Python installed in your local system, click here and run the Library Detection Tool to ensure that all the mandatory libraries needed for InMobi SDK integration [InMobi SDK, Picasso, browser, and RecyclerView] are available.


Get the Device ID

The device id is the Google Play Advertising ID (GPID). To get the device ID, configure the SDK to print debug logs to the console.

You can do so by adding the following line to your Activity where you are integrating InMobi ads.

InMobiSdk.setLogLevel(LogLevel.DEBUG);

The device ID will now be printed in debug logs in the DDMS console:


You will also get feedback on the diagnostics tab on the ad unit and ad request and this can be particularly helpful during integration. 


Helpful Debug Information

Once you have enabled debug logs as mentioned in step 1, SDK will print key logs to the DDMS console that provide useful information about the initialization and ad load lifecycle.

The following tables capture these logs.

SDK Initialization

Scenario

Log Level

Log message

Publisher passed a valid account id

Debug

InMobi SDK initialized with account id: <account id=""></account>

Publisher passed an invalid account Id

Debug

Invalid account id passed to init. Please provide a valid account id.

Publisher didn't grant the mandatory permissions

Debug

Please grant the mandatory permissions: INTERNET & ACCESS_NETWORK_STATE, SDK could not be initialized.

Permissions granted to the SDK

Debug

Permissions granted to the SDK are : <list granted="" of="" permissions=""></list>

Newer version of SDK is available

Debug

A newer version (ver. 9.0.0) of the InMobi SDK is available! You are currently on an older version (ver. 5.3.1). Download the latest InMobi SDK from http://www.inmobi.com/products/sdk/#downloads

 

Common Ad Lifecycle Messages

Scenario

Log Level

Log message

Ad requested when no network available

Error LogLevel

Network not reachable currently. Please try again.

Ad requested when ad state is loading or available

Error LogLevel

An ad load is already in progress. Please wait for the load to complete before requesting for another ad (Placement id: <placement id=""></placement>).

Ad requested when ad is viewed by user

Error LogLevel

An ad is currently being viewed by the user. Please wait for the user to close the ad before requesting for another ad (Placement id: <placement id=""></placement>).

Publisher device Id

Debug LogLevel

Publisher device id is <device id=""></device>

Requested ad being fetched from network

 

Ad will be fetched from network for the Placement Id - <placement id=""></placement>


Messages for Ad Integrations

Banner

Scenario

Log Level

Log message

Publisher called load on a banner

Debug

Fetching a Banner ad for placement id: <placement id=""></placement>

Successfully fetched ad

Debug

Banner ad successfully fetched for placement id: <placement id=""></placement>

Failed to fetch the ad

Debug

Failed to fetch Banner ad for placement id:<placement id=""></placement> with error: <status code="" message=""></status>

Started loading the banner in a webview

Debug

Started loading Banner ad markup in the webview for placement id: <placement id=""></placement>

Banner successfully loaded in the webview

Debug

Successfully loaded Banner ad markup in the webview for placement id: <placement id=""></placement>

Failed to load banner in the webview

Debug

NA

Banner refresh is initiated

Debug

Initiating Banner refresh for placement id: <placement id=""></placement>

invalid refresh interval

Debug

Refresh interval value supplied in XML layout is not valid. Falling back to default value.

Null Context

Error

Context supplied as null, the ad unit can't be created.

Layout params not set

Error

The layout params of the banner must be set before calling load

Height or width set to WRAP_CONTENT

Error

The height or width of a Banner ad can't be WRAP_CONTENT

Height or width not set

Error

The height or width of the banner cannot be determined

Null listener

Error

Please pass a non-null listener to the banner.

Interstitial

Scenario

Log Level

Log message

Publisher called load on interstitial

Debug

Fetching an interstitial ad for placement id: <placement id=""></placement>

Successfully fetched ad

Debug

Interstitial ad successfully fetched for placement id: <placement id=""></placement>

Failed to fetch the ad

Error

Failed to fetch interstitial ad for placement id:<placement id=""></placement> with error: <status code="" message=""></status>

Started loading the interstitial in a webview

Debug

Started loading interstitial ad markup in the webview for placement id: <placement id=""></placement>

Interstitial successfully loaded in the webview

Debug

Successfully loaded interstitial ad markup in the webview for placement id: <placement id=""></placement>

Failed to load interstitial in the webview

Error

Failed to load interstitial markup in the webview for placement id: <placement id=""></placement>

Failed to load interstitial in the webview due to timeout

Error

Failed to load the Interstitial markup in the webview due to time out for placement id: <placement id=""></placement>

Interstitial Ad displayed

Debug

Successfully displayed Interstitial for placement id:<placement id=""></placement>

Interstitial Ad dismissed

Debug

Interstitial ad dismissed for placement id:<placement id=""></placement>

No Listener specified Set Listener to null in constructor

Error

The Ad unit cannot be created as no event listener was supplied. Please attach a listener to proceed

Null context Set Context to null in constructor

Error

Unable to create ad unit with NULL context object

Ad show before ready Show ad before it's ready

Error

Ad Load is not complete. Please wait for the Ad to be in a ready state before calling show.

Rewarded Video

Scenario

Log Level

Log message

Publisher called load on interstitial

Debug

Fetching an interstitial ad for placement id: <placement id=""></placement>

Successfully fetched ad

Debug

Interstitial ad successfully fetched for placement id: <placement id=""></placement>

Failed to fetch the ad

Error

Failed to fetch interstitial ad for placement id:<placement id=""></placement> with error: <status code="" message=""></status>

Started loading the interstitial in a webview

Debug

Started loading interstitial ad markup in the webview for placement id: <placement id=""></placement>

Interstitial successfully loaded in the webview

Debug

Successfully loaded interstitial ad markup in the webview for placement id: <placement id=""></placement>

Failed to load interstitial in the webview

Error

Failed to load interstitial markup in the webview for placement id: <placement id=""></placement>

Failed to load interstitial in the webview due to timeout

Error

Failed to load interstitial markup in the webview due to timeout for placement id: <placement id=""></placement>

Interstitial Ad displayed

Debug

Successfully displayed Interstitial for placement id:<placement id=""></placement>

Interstitial Ad dismissed

Debug

Interstitial ad dismissed for placement id:<placement id=""></placement>

No Listener specified Set Listener to null in constructor

Error

The Ad unit cannot be created as no event listener was supplied. Please attach a listener to proceed

Null context Set Context to null in constructor

Error

Unable to create ad unit with NULL context object

Ad show before ready Show ad before it's ready

Error

Ad Load is not complete. Please wait for the Ad to be in a ready state before calling show The supplied resource id with show for animations is invalid

InMobiAdActivity not added

Error

Do not declare InMobiAdActivity in manifest file.

Native

Scenario

Log Level

Log Message

Publisher supplied a null context

Error

Unable to create InMobiNative ad with null Activity object

Publisher created a native ad without initializing the SDK

Error

Please initialize the SDK before creating a Native ad

Publisher created a native ad with an invalid placement id

Error

NA

Publisher supplies a null InMobiNativeAdListenerobject

Error

Listener supplied is null,the Native Ad cannot be created

Publisher called load on a native

Debug

Fetching a Native ad for placement id: <placement id=""></placement>

Ad is successfully fetched from server

Debug

Native ad successfully fetched for placement id: <placement id=""></placement>

Failed to fetch the ad

Error

Failed to fetch Native ad for placement id : <placement id=""></placement> with error : <status code="" message=""></status>

When AdView is inflated

Debug

Ad markup loaded into the container will be inflated into a View


In addition to logs printed by the SDK, you can also get feedback on the diagnostics tab on the ad unit and ad request, which can be particularly helpful during integration.  


Helpful Debug Information

Once you have enabled debug logs as mentioned in step 1, SDK will print key logs to the DDMS console that provide useful information about the initialization and ad load lifecycle.

The following tables capture these logs.

SDK Initialization

Scenario

Log Level

Log message

Publisher passed a valid account id

Debug

InMobi SDK initialized with account id: <account id=""></account>

Publisher passed an invalid account Id

Debug

Invalid account id passed to init. Please provide a valid account id.

Publisher didn't grant the mandatory permissions

Debug

Please grant the mandatory permissions: INTERNET & ACCESS_NETWORK_STATE, SDK could not be initialized.

Permissions granted to the SDK

Debug

Permissions granted to the SDK are : <list granted="" of="" permissions=""></list>

Newer version of SDK is available

Debug

A newer version (ver. 9.0.0) of the InMobi SDK is available! You are currently on an older version (ver. 5.3.1). Download the latest InMobi SDK from http://www.inmobi.com/products/sdk/#downloads

 

Common Ad Lifecycle Messages

Scenario

Log Level

Log message

Ad requested when no network available

Error LogLevel

Network not reachable currently. Please try again.

Ad requested when ad state is loading or available

Error LogLevel

An ad load is already in progress. Please wait for the load to complete before requesting for another ad (Placement id: <placement id=""></placement>).

Ad requested when ad is viewed by user

Error LogLevel

An ad is currently being viewed by the user. Please wait for the user to close the ad before requesting for another ad (Placement id: <placement id=""></placement>).

Publisher device Id

Debug LogLevel

Publisher device id is <device id=""></device>

Requested ad being fetched from network

 

Ad will be fetched from network for the Placement Id - <placement id=""></placement>


Messages for Ad Integrations

Banner

Scenario

Log Level

Log message

Publisher called load on a banner

Debug

Fetching a Banner ad for placement id: <placement id=""></placement>

Successfully fetched ad

Debug

Banner ad successfully fetched for placement id: <placement id=""></placement>

Failed to fetch the ad

Debug

Failed to fetch Banner ad for placement id:<placement id=""></placement> with error: <status code="" message=""></status>

Started loading the banner in a webview

Debug

Started loading Banner ad markup in the webview for placement id: <placement id=""></placement>

Banner successfully loaded in the webview

Debug

Successfully loaded Banner ad markup in the webview for placement id: <placement id=""></placement>

Failed to load banner in the webview

Debug

NA

Banner refresh is initiated

Debug

Initiating Banner refresh for placement id: <placement id=""></placement>

invalid refresh interval

Debug

Refresh interval value supplied in XML layout is not valid. Falling back to default value.

Null Context

Error

Context supplied as null, the ad unit can't be created.

Layout params not set

Error

The layout params of the banner must be set before calling load

Height or width set to WRAP_CONTENT

Error

The height or width of a Banner ad can't be WRAP_CONTENT

Height or width not set

Error

The height or width of the banner cannot be determined

Null listener

Error

Please pass a non-null listener to the banner.

Interstitial

Scenario

Log Level

Log message

Publisher called load on interstitial

Debug

Fetching an interstitial ad for placement id: <placement id=""></placement>

Successfully fetched ad

Debug

Interstitial ad successfully fetched for placement id: <placement id=""></placement>

Failed to fetch the ad

Error

Failed to fetch interstitial ad for placement id:<placement id=""></placement> with error: <status code="" message=""></status>

Started loading the interstitial in a webview

Debug

Started loading interstitial ad markup in the webview for placement id: <placement id=""></placement>

Interstitial successfully loaded in the webview

Debug

Successfully loaded interstitial ad markup in the webview for placement id: <placement id=""></placement>

Failed to load interstitial in the webview

Error

Failed to load interstitial markup in the webview for placement id: <placement id=""></placement>

Failed to load interstitial in the webview due to timeout

Error

Failed to load the Interstitial markup in the webview due to time out for placement id: <placement id=""></placement>

Interstitial Ad displayed

Debug

Successfully displayed Interstitial for placement id:<placement id=""></placement>

Interstitial Ad dismissed

Debug

Interstitial ad dismissed for placement id:<placement id=""></placement>

No Listener specified Set Listener to null in constructor

Error

The Ad unit cannot be created as no event listener was supplied. Please attach a listener to proceed

Null context Set Context to null in constructor

Error

Unable to create ad unit with NULL context object

Ad show before ready Show ad before it's ready

Error

Ad Load is not complete. Please wait for the Ad to be in a ready state before calling show.

Rewarded Video

Scenario

Log Level

Log message

Publisher called load on interstitial

Debug

Fetching an interstitial ad for placement id: <placement id=""></placement>

Successfully fetched ad

Debug

Interstitial ad successfully fetched for placement id: <placement id=""></placement>

Failed to fetch the ad

Error

Failed to fetch interstitial ad for placement id:<placement id=""></placement> with error: <status code="" message=""></status>

Started loading the interstitial in a webview

Debug

Started loading interstitial ad markup in the webview for placement id: <placement id=""></placement>

Interstitial successfully loaded in the webview

Debug

Successfully loaded interstitial ad markup in the webview for placement id: <placement id=""></placement>

Failed to load interstitial in the webview

Error

Failed to load interstitial markup in the webview for placement id: <placement id=""></placement>

Failed to load interstitial in the webview due to timeout

Error

Failed to load interstitial markup in the webview due to timeout for placement id: <placement id=""></placement>

Interstitial Ad displayed

Debug

Successfully displayed Interstitial for placement id:<placement id=""></placement>

Interstitial Ad dismissed

Debug

Interstitial ad dismissed for placement id:<placement id=""></placement>

No Listener specified Set Listener to null in constructor

Error

The Ad unit cannot be created as no event listener was supplied. Please attach a listener to proceed

Null context Set Context to null in constructor

Error

Unable to create ad unit with NULL context object

Ad show before ready Show ad before it's ready

Error

Ad Load is not complete. Please wait for the Ad to be in a ready state before calling show The supplied resource id with show for animations is invalid

InMobiAdActivity not added

Error

Do not declare InMobiAdActivity in manifest file.

Native

Scenario

Log Level

Log Message

Publisher supplied a null context

Error

Unable to create InMobiNative ad with null Activity object

Publisher created a native ad without initializing the SDK

Error

Please initialize the SDK before creating a Native ad

Publisher created a native ad with an invalid placement id

Error

NA

Publisher supplies a null InMobiNativeAdListenerobject

Error

Listener supplied is null,the Native Ad cannot be created

Publisher called load on a native

Debug

Fetching a Native ad for placement id: <placement id=""></placement>

Ad is successfully fetched from server

Debug

Native ad successfully fetched for placement id: <placement id=""></placement>

Failed to fetch the ad

Error

Failed to fetch Native ad for placement id : <placement id=""></placement> with error : <status code="" message=""></status>

When AdView is inflated

Debug

Ad markup loaded into the container will be inflated into a View


In addition to logs printed by the SDK, you can also get feedback on the diagnostics tab on the ad unit and ad request, which can be particularly helpful during integration.  

On This Page

Last Updated on: 01 Sep, 2021

Android Changelogs

We are constantly improving the InMobi SDK to ensure that you get the best results on app monetization. The release notes here will give you an overview of all the important changes on InMobi SDK that impact our publishers.

Build 9.2.1 [08/September/2021]

    • Added Partner provided GDPR consent support

    • Crash fixes

Build 9.2.0 [06/July/2021]

    • Landing page opening management

    • Native support for click and impression tracking

    • MavenCentral auto fetch the mandatory dependency

    • Bug fixes and improvements

Build 9.1.9 [26/April/2021]

    • Unified ID Bugfix

Build 9.1.7 [26/March/2021]

    • Unified ID support

    • AdPods support

    • Bug fixes and improvements

Build 9.1.6 [16/February/2021]

    • Migrated to AndroidX

    • Bug fixes and improvements

    • Refactored Audience Bidding Support

    • Interface changes

  • APIs Added
    • InMobiSdk
      • public static String getToken(@Nullable Map&lt;String, String&gt; extras, @Nullable String keywords)

      • public static String getToken()

Build 9.1.1 [19/October/2020]

    • Bug fixes and improvements

    • Update support for the following mediation adapters:

  1. Facebook SDK v6.1.0
  2. AdMob SDK v19.4.0

Build 9.1.0 [18/September/2020]

    • Support for Android 11

    • Support for GDPR Transparency & Consent Framework IAB TCF v2.0

    • Improvements and Bug fixes

Build 9.0.7 [08/June/2020]

  • Critical bug fixes and optimizations

Build 9.0.6 [08/May/2020]

  • Bug Fixes for MAX Audience Bidder & WebView

Build 9.0.5 [24/April/2020]

  • MAX Audience Bidding Support
  • Custom Audience Bidding Support
  • MoPub Audience Bidding Support
  • Several Threading Optimizations and Improvements
  • Bug Fixes
  • Interface changes
    • - APIs Added
      • BannerAdEventListener

        public void onAdFetchSuccessful(@NonNull InMobiBanner ad, @NonNull AdMetaInfo info)

        public void onAdLoadSucceeded(@NonNull InMobiBanner ad, @NonNull AdMetaInfo info)

        public void onAdFetchFailed(@NonNull InMobiBanner ad, @NonNull InMobiAdRequestStatus status)

      • InterstitialAdEventListener

        public void onAdFetchSuccessful(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info)

        public void onAdLoadSucceeded(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info)

        public void onAdDisplayed(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info)

        public void onAdFetchFailed(@NonNull InMobiInterstitial ad, @NonNull InMobiAdRequestStatus status)

      • NativeAdEventListener

        public void onAdFetchSuccessful(@NonNull InMobiNative ad, @NonNull AdMetaInfo info)

        public void onAdLoadSucceeded(@NonNull InMobiNative ad, @NonNull AdMetaInfo info)

      • PreloadManager

        void preload()

        void load()

      • InMobiBanner

        @NonNull public PreloadManager getPreloadManager()

      • InMobiInterstitial

        @NonNull public PreloadManager getPreloadManager()

    • - APIs Deprecated
      • BannerAdEventListener

        public void onAdLoadSucceeded(@NonNull InMobiBanner ad)

      • InterstitialAdEventListener

        public void onAdLoadSucceeded(@NonNull InMobiInterstitial ad)

        public void onAdReceived(@NonNull InMobiInterstitial ad)

        public void onAdDisplayed(@NonNull InMobiInterstitial ad)

      • NativeAdEventListener

        public void onAdLoadSucceeded(@NonNull InMobiNative ad)

        public void onAdReceived(@NonNull InMobiNative ad)

      • InMobiBanner

        public JSONObject getAdMetaInfo()

        public String getCreativeId()

      • InMobiInterstitial

        public JSONObject getAdMetaInfo()

        public String getCreativeId()

      • InMobiNative

        public JSONObject getAdMetaInfo()

        public String getCreativeId()

Build 9.0.4 [3/March/2020]

  • Added support for InMobi Initialization callback
  • Improvements and Bug Fixes
  • Interface Changes
    • - APIs Added
      • InMobiSdk

        public static void init(@NonNull final Context context, @NonNull @Size(min = 32, max = 36) String accountId, @Nullable JSONObject consentObject, @Nullable final SdkInitializationListener sdkInitializationListener)

      • SdkInitializationListener

        void onInitializationComplete(@Nullable Error error)

    • - APIs Deprecated
      • InMobiSdk

        public static @InitializationStatus String init(@NonNull final Context context, @NonNull @Size(min = 32, max = 36) String accountId)

        public static @InitializationStatus String init(@NonNull final Context context, @NonNull @Size(min = 32, max = 36) String accountId, @Nullable JSONObject consentObject)

Build 9.0.2 [27/January/2020]

  • Added support for success/failure status for InMobi Initialization
  • Proactive detection of abnormal network calls by fraudulent creatives
  • Improvements and Bug Fixes
  • Interface Changes
    • - APIs Updated

      InMobiSdk

Build 9.0.1 [25/October/2019]

  • Added support for IAB GDPR consent string
  • Updated OMSDK to v1.2.19
  • Added Banner refresh support from SSUI
  • Added support for Facebook Audience Network 5.5
  • Bug Fixes for SDK and AudienceBidder Plugin

Build 9.0.0 [20/September/2019]

  • Modular SDK

    - Added an ability to integrate Mediation as a separate module.

  • Added support for Android 10
  • Support for Mopub 5.8
  • Interface Changes
    • - APIs added

      AerServTransactionInformation

      public String getCreativeID()

    • - APIs removed
      • InMobiNative

        public InMobiNative(Context context, long placementId, NativeAdListener listener)

        public void setNativeAdListener(NativeAdListener listener)

      • InMobiNative.NativeAdListener
      • InMobiBanner

        public void setListener(BannerAdListener listener)

      • InMobiBanner.BannerAdListener
      • InMobiInterstitial

        public InMobiInterstitial(Context context, long placementId, InterstitialAdListener2 listener)

        public void setInterstitialAdListener(InterstitialAdListener2 listener)

      • InMobiInterstitial.InterstitialAdListener2
  • Bug fixes and performance improvements

Build 8.2.1 [21/August/2019]

  • Bug Fixes for SDK and AudienceBidder Plugin

Build 8.2.0 [02/Aug/2019]

  • Chrome Custom tabs support
  • Thread Optimizations
  • Bug Fixes for SDK and AudienceBidder Plugin

Build 8.1.3 [05/July/2019]

  • Audience Bidder support for DFP
  • Bug Fixes

Build 8.1.2 [13/Jun/2019]

  • Updated AdColony SDK support to 3.3.10
  • Updated Audience Network (Facebook) support to 5.3.1

Build 8.1.1 [28/May/2019]

  • Improved Stability with crash fixes
  • Thread and Memory Optimizations
  • Support for new Picasso version 2.71828

### API added

  • NativeAdEventListener

public void onAdReceived(InMobiNative ad)

Build 8.1.0 [15/May/2019]

  • AudienceBidder
  • Added support for AppNexus
  • Added keyword implementation for MoPub
  • Added DFP plugin

Build 8.0.9 [24/Apr/2019]

  • Bug fixes

Build 8.0.8 [17/Apr/2019]

  • Bug fixes

Build 8.0.7 [05/Apr/2019]

  • Bug fixes
  • Updated AudienceBidder to v1.0.1
  • Support for Amazon Publsiher Service
  • Support for granular keywords
  • Fix issue with updateBid not working with MoPub's refresh
  • Replaced source file with a aar
  • Change in API (see documentation)

Build 8.0.5 [11/Mar/2019]

  • Added InMobi's Audience Bidder for MoPub
  • Update support for the following mediation adapters
  • AdColony SDKv 3.3.7
  • AdMob SDKv 17.1.1
  • AppLovin SDKv 9.1.0
  • AppNext SDKv 2.4.4.472
  • Audience Network (Facebook) SDKv 5.1.0
  • Chartboost SDKv 7.3.1
  • Flurry (Yahoo) SDKv 11.4.0
  • MoPub SDKv 5.4.1
  • MyTarget SDKv 5.3.1
  • Oath (AOL) SDKv 6.8.2
  • Unity SDKv 3.0.0
  • Vungle SDKv 6.3.24
  • Deprecated Tremor support
  • Deprecated Flurry (Yahoo) Banner
  • Added support for additional reporting for AppLovin and Chartboost
  • Bug fixes

Build 8.0.1 [28/Nov/2018]

  • Bug Fixes

Build 8.0.0 [17/Oct/2018]

  • Unification of InMobi SDK and AerServ SDK

Build 7.3.0 [25/July/2019]

  • Bug fixes.

Build 7.2.9 [10/July/2019]

  • Removal of createCalendar API from Mraid.
  • Support for new Picasso version 2.71828.
  • Bug fixes.

### Interface changes

  • API added:
  • InMobiNative

public Boolean isVideo()

Build 7.2.8 [6/May/2019]

  • Bug fixes.

### Interface changes

  • API added:
  • NativeAdEventListener

public void onAdReceived(InMobiNative ad)

Build 7.2.7 [25/Feb/2019]

  • MMA SDK Integration (China only)
  • Gif Enhancements

### Interface changes

  • Deprecated API:
  • InMobiNative

public static void requestAd(Context context, final InMobiAdRequest adRequest,

NativeAdRequestListener listener)

  • InMobiBanner

public static void requestAd(Context context, final InMobiAdRequest adRequest,

BannerAdRequestListener listener)

  • InMobiInterstitial

public static void requestAd(Context context, InMobiAdRequest adRequest,

InterstitialAdRequestListener interstitialAdRequestListener)

Build 7.2.6 [8/Feb/2019]

  • Bug fix - Avoid crash in WebView processing.

Build 7.2.4 [14/Dec/2018]

  • Bug fix - Release resource for failures with multiple banners in single AdContainer.

On This Page

Last Updated on: 08 Sep, 2021