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.

Note: For MoPub SDK 5.17 and below, this step is required.

- 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()
          .withAdditionalNetwork(InMobiAdapterConfiguration.class.getName())
          .withMediatedNetworkConfiguration(InMobiAdapterConfiguration.class.getName(), inMobiSettings)
          .build();
    
      // Continue initializing MoPub
    

- 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.additionalNetworks = @[InMobiAdapterConfiguration.class];
      sdkConfig.mediatedNetworkConfigurations = config;
    
      // Continue initializing MoPub
    

- Unity:

Option 1: Use the MoPub Manager

Attach the InMobi Network Configuration script to your MoPub Manager Prefab, enable the script, and populate the accountid information. Refer to the Network Configuration (Mediation) topic for an example.

Option 2: Initialize Manually

MoPub.InitializeSdk(new MoPub.SdkConfiguration {
  
    // Define the InMobi account id you want to initialize with
    MediatedNetworks = new MoPub.MediatedNetwork[]
    {
        new MoPub.MediatedNetwork
        {
          // Specify the class name that implements the AdapterConfiguration interface.
          #if UNITY_ANDROID
              AdapterConfigurationClassName = "com.mopub.mobileads.InMobiAdapterConfiguration", 
          #else // UNITY_IOS
              AdapterConfigurationClassName = "InMobiAdapterConfiguration",
          #endif

          // Fill in settings and configuration options the same way as for supported networks:
          NetworkConfiguration = new Dictionary<string,string> {
            { "accountid", YOUR_INMOBI_ACCOUNT_ID },
          },
    },
});

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:

  • iOS:

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

      IMCompletionBlock completionBlock = ^{
        [IMSdk initWithAccountID:@"YOUR_INMOBI_ACCOUNT_ID"
               consentDictionary:nil
               andCompletionHandler:^( NSError* _Nullable error) {
                  
                // Note that the steps below are required if your MoPub SDK is 5.17 or below.
                NSDictionary * inMobiConfig = @{@"accountid": @"YOUR_INMOBI_ACCOUNT_ID"};NSMutableDictionary * config = [@{@"InMobiAdapterConfiguration" : inMobiConfig} mutableCopy];
                sdkConfig.additionalNetworks = @[InMobiAdapterConfiguration.class];
                sdkConfig.mediatedNetworkConfigurations = config;
    
                // Initialize MoPub SDK after InMobi finish initialize.    
                [[MoPub sharedInstance] initializeSdkWithConfiguration:sdkConfig completion:^{
                    NSLog(@"SDK initialization complete");}];
        }];
      };
    
    
  • Android:

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

      // Initialize InMobi SDK
      InMobiSdk.init(this, "YOUR_INMOBI_ACCOUNT_ID", null, (SdkInitializationListener) error -> {
    
          // Note that the steps below are required if your MoPub SDK is 5.17 or below.
          Map<String, String> inmobiConfig = new HashMap<>();
          inmobiConfig.put("accountid", "YOUR_INMOBI_ACCOUNT_ID");
     
          SdkConfiguration sdkConfiguration = new SdkConfiguration.Builder("AD_UNIT_ID")
                                       .withAdditionalNetwork(InMobiAdapterConfiguration.class.getName())
                                       .withMediatedNetworkConfiguration(InMobiAdapterConfiguration.class.getName(), inmobiConfig)
                                       .build();
    
         // Initialize MoPub SDK after InMobi finish initialize.                              
         MoPub.initializeSdk(this, sdkConfiguration, initSdkListener());
      });
    
  • 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 October 04, 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.)