InMobi

If you plan to use the MoPub SDK to load and display ads from InMobi via mediation, use this article for integration instructions and information unique to the ad network. To learn more about how MoPub mediation works, refer to our MoPub Network Mediation article.

Supported Ad Formats

InMobi currently supports the following ad formats. For support information, visit the InMobi homepage.

MoPub Formats InMobi Ad Formats
Banner, Medium Rectangle Banner Ad
Interstitial Interstitial
Rewarded Ad Rewarded Video

Download and Integrate

To download the InMobi adapters, navigate to the Mediation Integration Tool.

Note: If you previously have a custom InMobi network setup, please follow our migration guide here

For the latest download and integration instructions, consult InMobi’s tutorials (iOS, Android) before you integrate the SDK and adapters.

  • For Android, all InMobi adapters are released as an Android Archive (AAR) file. The AAR includes the required Manifest data for InMobi. As a result, you no longer need to update your AndroidManifest manually for any generic data, such as permissions and Activities. Any other app-level placement configuration required by InMobi must be manually entered into the AndroidManifest. For optional permissions InMobi recommends, please see the Additional Configurations topic here.

Integration Prerequisites

To ensure a proper integration, read through the prerequisites for your respective platform:

  • For iOS apps (including those built from Unity): See Important Prerequisites section here.

  • For Android apps (including those built from Unity) : See Add & Verify Dependencies section here.

Set Up InMobi on the MoPub Dashboard

  • Account Id and Placement Id information are required.

Initialization Network Configuration

InMobi requires your Account Id information to successfully initialize. This will be done when an ad request is made (if the SDK has not been initialized before), or during MoPub initialization, which will ensure InMobi initializes early on. You can follow the below guidelines to ensure the previous. If you’re using Advanced Bidding with InMobi, please jump to Advanced Bidding Requirements instead.

- Android:

  • You can enter your Account Id (accountid) as a String parameter.

      // Declare your InMobi accountid
      Map<String, String> inMobiSettings = new HashMap<>(); inMobiSettings.put("accountid","YOUR_INMOBI_ACCOUNT_ID");
    
      SdkConfiguration sdkConfiguration =
      new SdkConfiguration.Builder()
          .withMediatedNetworkConfiguration(InMobiAdapterConfiguration.class.getName(), inMobiSettings)
          .build();
    
      // Continue initializing MoPub
    

    Note: If you are using InMobi with MoPub SDK version 5.16.4 and/or below, then you should also call .withAdditionalNetwork(InMobiAdapterConfiguration.class.getName()) to the SDK config builder.

- iOS:

  • You can enter your Account Id (accountid) as a String parameter.

      // Declare your InMobi App Id and Ad Units
      NSDictionary * inMobiConfig = @{@"accountid": @"YOUR_INMOBI_ACCOUNT_ID"};
    
      NSMutableDictionary * config = [@{@"InMobiAdapterConfiguration" : inMobiConfig} mutableCopy];
    
      sdkConfig.mediatedNetworkConfigurations = config;
    
      // Continue initializing MoPub
    

    Note: If you are using InMobi with MoPub SDK version 5.16.2 and/or below, then you should also call .additionalNetworks = [InMobiAdapterConfiguration.self]; to the SDK config builder.

- Unity:

  • Using MoPubManager Prefab: Ensure you attach InMobi Network Configuration script to your MoPub Manager Prefab, enable the script, and populate the App Key information. Please see the “Network Configuration (Mediation)” topic here for an example.

  • Manual Initialization:

      MoPub.InitializeSdk(new MoPub.SdkConfiguration {
          // Define the InMobi account id you want to initialize with
          MediatedNetworks = new MoPub.MediatedNetwork[]
          {
              new MoPub.SupportedNetwork.InMobi
              {
                  NetworkConfiguration = new Dictionary<string,object> {
                      { "accountid", "YOUR_INMOBI_ACCOUNT_ID" }
                  },
              },
          },
      });
    

    Note: If you are using InMobi with MoPub SDK version 5.16.4 and/or below, then you should also pass in InMobi to MediatedNetwork array in your SDK config builder. Please see an example here.

Advanced Bidding Requirements

There is one requirement to ensure InMobi Advanced Bidding works as expected:

1- Pre-initialization of InMobi

In order to properly generate an Advanced Bidding Token and have InMobi bid on Advanced Bidding bid requests, InMobi SDK needs to be initialized before the MoPub SDK. Follow the below steps to do that:

Optional: Since MoPub-InMobi adapters do not handle GDPR at this time, you can optionally and manually pass consent to InMobi. This is possible only if you’re not relying on MoPub for acquiring consent, as MoPub will not be initialized at this pre-initialization point. For additional details, please see InMobi GDPR guide, or InMobi initialization details here: iOS, Android which explains what they expect in consentObject.

  • iOS:

    Implement the following just before where you call MoPub SDK Initialization.

      void (^completionBlock)(NSError*) = ^( NSError* _Nullable  error) { 
        if (error) { 
            NSLog(@"SDK Initialization Error - %@", error.description); 
        } 
        else { 
            NSLog(@"IM Media SDK successfully initialized"); 
        } 
      }; 
      [IMSdk setLogLevel:kIMSDKLogLevelDebug]; 
      [IMSdk initWithAccountID:kIMAccountID 
             consentDictionary:@{IM_GDPR_CONSENT_AVAILABLE: @"true", // OPTIONAL
                                 IM_GDPR_CONSENT_IAB: @"<<consent in IAB format>>"} // OPTIONAL
          andCompletionHandler:completionBlock]; 
    
  • Android:

    Implement the following just before where you call MoPub SDK Initialization.

      // OPTIONAL: Prepare InMobi GDPR Consent
      JSONObject consentObject = new JSONObject();
      try {
          consentObject.put(InMobiSdk.IM_GDPR_CONSENT_AVAILABLE, true);
          // If you obtain your consent outside and before MoPub initialization sequence, and have it available at this time, you can include it here.
          consentObject.put("gdpr", "0"); // "0" or "1"
          consentObject.put(InMobiSdk.IM_GDPR_CONSENT_IAB,  << consent in IAB format >> );
      } catch (JSONException e) {
          e.printStackTrace();
      }
    
      // Initialize InMobi SDK - consent is optional
      InMobiSdk.init(this, "YOUR_INMOBI_ACCOUNT_ID", consentObject, (SdkInitializationListener) error -> {
          if (null != error) {
              Log.e(TAG, "InMobi Init failed -" + error.getMessage());
          } else {
              Log.d(TAG, "InMobi Init Successful");
          }
      });
    
  • Unity: Apply the Initialization Network Configuration requirements for Unity described here.

Test an Ad

We recommend that you test your InMobi integration using MoPub mediation test mode to verify that the adapter works as expected. Test mode must be set up on both the MoPub side and the InMobi side.

Set Up Test Mode on the MoPub Side

Refer to our Mediation Test Mode article for complete details on using this mode.

Set Up Test Mode on the InMobi Side

The InMobi UI supports a global test mode, which you can enable for each platform, and target to specific test devices. For instructions on enabling test mode in the InMobi UI, refer to the InMobi instructions for testing. Note that test mode is applied to your project globally, but will only serve test ads to the test devices you have set up.

Enter your test device details in the InMobi UI to ensure that test ads are delivered only to your test device. Refer to the InMobi instructions for enabling a device for testing in the InMobi UI.

Migrate InMobi from Custom Native Setup

Below information is for publishers who will migrate from a A) Custom InMobi setup to a B) Supported InMobi setup, and/or will use Advanced Bidding with MoPub-InMobi. Below details will explain you the differences:

A) Custom Instance

  • For pre-supported instance of InMobi - MoPub Network setup.
  • This includes unsupported and custom adapters and custom network setup on MoPub UI.
  • This setup can be used for Traditional ads only.

B) Supported Instance

  • For Supported instances of InMobi - MoPub Network setup.
  • This includes MoPub certified and supported adapters and certified network setup on MoPub UI.
  • This setup can be used for Advanced Bidding and Traditional ads.
  • This is the recommended setup for mediating InMobi on MoPub platform going forward.

Supported Instance has different UI setup requirements and uses different adapters (with different classnames) than Custom Instance. You will need to support Supported Instance and Custom Instance together until a full migration to Supported Instance happens.

If you directly migrate to Supported Instance, by updating your network setup on the UI, and updating line items, and then releasing an update to your apps with supported adapters, not all users might update right away. Therefore their Custom InMobi adapters won’t be able to serve the new Supported Instance on the UI. This causes an issue. To overcome it, you need to maintain both instances until a full migration happens. You can find information on how to do this below.

Note: Reminding you that this is given that you already have an existing Custom InMobi setup in place on the MoPub UI, and Custom adapters shipped out and actively serving ads on your applications. If you are going to begin using InMobi on MoPub platform from scratch, you do not need to go through this migration process.

Migration status will look like this:

MoPub Setup Status Your App’s Status Capabilities Ad requests † Next Steps
Custom Instance User is on old version of the app.
Only Custom adapters are present.
Only Custom traditional line items can be served. Ad requests will hit InMobi Custom line items and Custom adapters. Once all (or enough) users update their app which has Supported adapters, this setup can be abandoned.
Custom integration on MoPub UI can be removed, line items can be deleted, or deactivated.
Supported Instance User is on new version of the app.
Only Supported adapters are present.
Only Supported traditional line items can be served.
Only Supported Advanced Bidding line items can be served.
Native will be available once a future native adapters release is made.
Ad requests will hit InMobi Supported line items and Supported adapters. Use continuously going forward.

These will have the same account/placement Id setup, CPMs and Priorities with Supported ones. So the resulting ads will be the same.

Migration Steps

MoPub UI Steps

  • Setup InMobi Supported Network Instance on MoPub UI

    • Visit Networks tab on your MoPub UI. Select New Network and setup InMobi (SDK network) as a supported network.
  • For each Custom Instance InMobi line item present that you wish to maintain, you need to create a matching Supported Instance InMobi line item. This has to be done across all your ad units in all your apps.

    • Go through each of your Apps and Ad Units that contain custom InMobi line items.

    • For each Active/Enabled custom InMobi line item, create a matching Supported InMobi line item with the same configuration (InMobi Account Id and Placement Id information).

      • While creating your line items, you can either set InMobi Account Id and Placement Id information via the Override Settings at line item edit/create page,

      • Or if the line item information would be the same across an ad unit, you can do it on Networks Tab > InMobi Settings > App & Ad unit setup.

    • For each Supported line item you create, you would ideally want to have it at the same priority with the same CPM of the corresponding Custom line item. This will ensure that line items will mirror each other without friction.
      Note: While making changes on the line items in the future, ensure the Priority and CPM values are consistent.

    • If you will use Advanced Bidding:

      • You can work together with your MoPub account manager to setup InMobi Advanced Bidding network settings.

      • Set up Advanced Bidding in the ad unit page for each ad unit.

Integration Steps

  • On your application, completely remove Custom InMobi adapters from your application which are mentioned in Custom Instance setup earlier in this guide.

  • You don’t need to remove the InMobi SDK. Instead you need to update it to the most recent InMobi SDK that is certified by MoPub.

  • Install Supported InMobi adapters by referring to MoPub Mediation Integration Tool:

  • You can ship your application with this setup and only update InMobi SDK and MoPub adapters going forward.

Next Steps

Once you ship your Supported Instance with the above setup, you will be maintaining both Supported Instance and Custom Instance going forward. Once after a desired majority of your users move to the version of your app that has the Supported setup, you can deprecate your Custom setup, by removing your Custom InMobi MoPub UI setup, and Custom InMobi line items.

Additional Support

For inquiries and support, please raise a ticket to InMobi here.


Last updated May 03, 2021

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2021 MoPub (a division of Twitter, Inc.)