exchange | Getting Started

This guide is for all app developers and publishers who wish to monetize the ad inventory on their iOS or Android apps using the light weight InMobi SDK. Before you begin integrating the SDK into your app, please follow the steps below to set up an account with InMobi, register your app and create ad placements:

Follow the simple steps and get started:

Along the way, we have highlighted important guidelines and best practices to ensure you have everything in place to monetize your app quick and easy without our assistance. Ensure that you pause for a moment to read through these messages.

Step 1: Signup with InMobi

Now that you’re here and InMobi is the chosen one, what are you waiting for? Let’s get started with your account right away. To set up an InMobi account:

  1. Sign up as a publisher.
  2. A verification email with a link will be sent to your registered email address. Click on the link to complete the verification process. (This address will be used for any future communication about your account).
  3. On log in, choose the applicability pertaining to GDPR.

Step 2: Register your App

Once you have created an account, you can proceed to register your app with InMobi. The following steps are only meant for apps published in an app store. If you have an app that is yet to be published, visit Step 2A. Let's proceed.

  1. Click Add an app

  2. Select your relevant Operating System
  3. Enter a valid app store URL
  4. Click Add to list additional apps you wish to monetize.
  5. View your completed profile from the drop down next to your user name.

Important: Please take a moment to read the compliance guidelines for properties directed to children below 13 years, and then select the check box if it applies to you.

Step 2A: Register an Unpublished App

If you have an unpublished app that is not live in the app store, just follow the simple steps below:

  1. Sign up as a Publisher.
  2. Complete the verification e-mail sent to the registered ID (The registered email ID here will receive all the communication).
  3. Choose the applicability pertaining to GDPR.
  4. Click Add app as shown in the dialog box.
  5. Choose operating system.
  6. When it's published, you can return to InMobi and link your app to its app store entry.

Remember: For apps without a URL, the test mode is enabled by default. Once live, you can click the link to enter the URL on the dashboard as shown below.

Step 3: Create Placements

  1. Select the relevant ad format to define the placement of your app.

  2. Scroll to your right/left to see more placements
  3. Enter details in Placement Name and click Create Placement
  4. Click Add Placement to create additional placements
  5. Once the setup is complete, you will get an overview of the placement details.

Important:
For Rewarded Video, please set the placement type to Interstitial.
For Native ad units, please ensure the right format and aspect ratio is selected.

Step 4: Update Payment Profile

Create, verify and activate your payment profile to make your earnings tangible! InMobi follows a payout cycle of 60 days. This means that your earnings for a given month will be credited to you at the end of the 60-day payout cycle. You have the option of receiving your payouts via PayPal or wire transfer/RTGS.

Note: This is a mandatory step and all publishers are requested to complete the details to monetize successfully.

  1. Select Earnings from the drop down next to your user name
  2. Select Add Account
  3. Add the following details:
    • Mode of Transfer
    • Bank Details
    • PAN Card Details
    • GST Details
  4. Once the setup is done, you will get an overview of your Payment Page.

Note: Your Payment Id is available under your account summary as shown below. You will be able to view it, after the payment details you provided are verified and approved.

Step 5: Control Ad Experience with Filters

By using the blocking controls built into InMobi, you can curate the experience shown to the user by reviewing and controlling the ads that appear in your app. InMobi supports ad filters at three levels to control the ad experience:

Level 1: Domain Filters

You can block ads from specific URLs. For example, you might not want to show your competitors' ads on your apps.


Level 2: URL or Keyword Filters

You can block ads by filtering URLs /Keyword Filters based on their ad text or landing page URL. For example, you can prevent ads containing the text 'weapons' or 'virus' from serving on your site or app.


Level 3: Category Filters

You can block ads from specific categories which will not be served on your app. The categories range from Business, Art, Finance, Fashion etc. For example, an app meant for kids has the option to block ads from specific categories.

Note: InMobi provides provision for blocking sensitive categories. You can block ads being served on content that includes topics such as politics, religion, mature content, gambling, etc.

Note: Blocking any ad will lower your potential earnings as it reduces competition for your inventory by removing advertiser bids from the auction. We recommend blocking only those ads that you feel are absolutely irrelevant and inappropriate to your content or your users.

exchange | Mediated Networks

exchange | InMobi Mediation

exchange | Open RTB Integration Documents

Please refer to the following Open RTB documentation for any demand side integration. The documentation below contains information specific to InMobi’s implementation only.

exchange | Audience bidding for Custom Mediation (iOS)

In order to start setting up, you’ve to ensure that the steps mentioned in the (available InMobi Integration) have already been incorporated.

Initialise the SDK

Step1: Initialise the SDK, after the completion of Initialisation process, completion handler will be called.

void (^completionBlock)(NSError*) = ^( NSError* _Nullable  error) { 
	if (error) { 
        NSLog(@"SDK Initialization Error - %@", error.description); 
	} 
    else { 
        NSLog(@"IM Media SDK successfully initialized"); 
    } 
}; 
[IMSdk initWithAccountID:kIMAccountID consentDictionary:<gdpr consent dictionary>} andCompletionHandler:completionBlock];
	

Note: Kindly refer to the integration document for details about creating the gdpr consent dictionary.

Once you have added the SDK for iOS successfully, please follow the steps below to load the following ad units using Audience Bidding.

  1. Banner Ads
  2. Interstitial Ads

Banner Ads

Step 1: Setting up a Banner Ad and add it to your app.

Create an Instance of IMBanner.

IMBanner* bannerAd = [[IMBanner alloc] initWithFrame:frame placementId:<placementId>];
	

Notes:

  • A banner instance must be created on the main thread.
  • Similarly, all methods on this instance must be called on the main thread. Not doing so will lead to unpredictable behaviour and may affect your ability to monetize with InMobi.
  • Creating an IMBanner object before SDK initialization results in a nil being returned.
Set delegate of IMBanner

To set the delegate of the IMBanner, call:

bannerAd.delegate = self;
	

Step 2: Requesting for Bid

Requesting a bid requires IMBanner Instance,. After setting delegate of IMBanner, call preload on IMBannerPreloadManager. IMBanner has an instance of IMBannerPreloadManager as its property.

For requesting bid, call following line.

[bannerAd.preloadManager preload];
	

Implement the following IMBannerDelegates:

/** 
* Notifies the delegate that the banner has recieved the ad with the meta/transaction info. 
*/  
-(void)banner:(IMBanner*)banner didReceiveWithMetaInfo:(IMAdMetaInfo*)info { 
  	NSLog(@”bid fetched:%@”, info.getBd()); 
} 
/** 
* Notifies the delegate that the banner has failed to preload with some error. 
* It will only be recieved when preload is called. 
*/ 
-(void)banner:(IMBanner*)banner didFailToReceiveWithError:(IMRequestStatus*)error { 
	NSLog(@”bid failed to be fetched”); 
}
	

Note: Please do not destroy this instance of IMBanner, as this will be needed if InMobi wins the auction.

Step 3: Loading the Banner Ad

In case InMobi has won the auction, then you can call the load method on the preloadManager property on the IMBanner instance to load the ad.

For loading the banner ad, call following line.

[bannerAd.preloadManager load];
	

Implement the following IMBannerDelegates:

/** 
* Notifies the delegate that the banner has finished loading 
*/ 
-(void)bannerDidFinishLoading:(IMBanner*)banner { 
   	NSLog(@”Banner ad did finish loading”); 
} 
** 
* Notifies the delegate that the banner has failed to load with some error. 
*/ 
-(void)banner:(IMBanner*)banner didFailToLoadWithError:(IMRequestStatus*)error { 
   	NSLog(@”banner ad failed to load”); 
}
	

Interstitial Ads

Step 1: Setting up an Interstitial Ad and add it to your app.

Create an Instance of IMInterstitial.

IMInterstitial* interstitialAd = [[IMInterstitial alloc] initWithPlacementId:<placementId> delegate:<delegate>];
	

Notes:

  • An Interstitial instance must be created on the main thread.
  • Similarly, all methods on this instance must be called on the main thread. Not doing so will lead to unpredictable behaviour and may affect your ability to monetize with InMobi.
  • Creating an IMInterstitial object before SDK initialization results in a nil being returned.

Step 2: Requesting for Bid

Requesting a bid requires IMInterstitial Instance,. Invoke the preload method on IMInterstitialPreloadManager. IMInterstitial has an instance of IMInterstitialPreloadManager as its property.

For requesting bid, call following line.

[interstitialAd.preloadManager preload];
	

Implement the following IMInterstitialDelegate:

/** 
* Notifies the delegate that the ad server has returned an ad. Assets are not yet available. 
* Please use interstitialDidFinishLoading: to receive a callback when assets are also available. 
*/ 
-(void)interstitial:(IMInterstitial*)interstitial didReceiveWithMetaInfo:(IMAdMetaInfo*)metaInfo { 
   	NSLog(@”bid fetched:%@”, info.getBd()); 
} 
/** 
* Notifies the delegate that the interstitial has failed to recieve an Ad(failed to preload an ad) with some error. 
* This callback will only be recieved when Preload is called. 
*/ 
-(void)interstitial:(IMInterstitial*)interstitial didFailToReceiveWithError:(NSError*)error { 
   	NSLog(@”bid failed to be fetched”); 
}
	

Note: Please do not destroy this instance of IMInterstitial, as this will be needed if InMobi wins the auction

Step 3: Loading the Interstitial Ad

In case InMobi has won the auction, then you can call the load method on the preloadManager property of the IMInterstitial instance to load the ad.

For loading the interstitial ad, call following line.

[interstitialAd.preloadManager load];
	

Implement the following IMInterstitialDelegate:

/** 
* Notifies the delegate that the interstitial has finished loading and can be shown instantly. 
*/ 
-(void)interstitialDidFinishLoading:(IMInterstitial*)interstitial { 
   	NSLog(@”Interstitial ad did finish loading”); 
} 
/** 
* Notifies the delegate that the interstitial has failed to load with some error. 
*/ 
-(void)interstitial:(IMInterstitial*)interstitial didFailToLoadWithError:(IMRequestStatus *)error { 
   	NSLog(@”Interstitial ad failed to load”); 
}
	

Step 4: Show the Interstitial Ad

As Interstitial ad is already loaded, to show the interstitial ad call the following:

[interstitialAd showFromViewController:<viewController>];
	

Implement the following IMInterstitialDelegate:

/** 
* Notifies the delegate that the interstitial would be presented. 
*/ 
-(void)interstitialWillPresent:(IMInterstitial*)interstitial { 
   	NSLog(@”interstitialWillPresent”); 
}  
/** 
* Notifies the delegate that the interstitial has been presented. 
*/ 
-(void)interstitialDidPresent:(IMInterstitial*)interstitial { 
   	NSLog(@” interstitialDidPresent”); 
} 
/** 
* Notifies the delegate that the interstitial has failed to present with some error. 
*/ 
-(void)interstitial:(IMInterstitial*)interstitial didFailToPresentWithError:(IMRequestStatus*)error { 
    NSLog(@” interstitial didFailToPresentWithError”); 
}
	

exchange | Audience Bidding for MoPub (Android)

Prerequisites

Make sure that your Android application meets the following requirements before proceeding.

  • Android 4.2.2 (Jelly Bean, API 17) and higher. MRAID ads require API 19 and higher.
    Older Android versions may work, but are not officially supported.
  • Google Play Services will adhere to the user’s ad tracking preferences. For more information, please see Google's website regarding their Advertising ID.

Note: If you are using Android Studio 3.0+, you'll need to disable AAPT 2.0. To do this, you'll need to add the following to your gradle.properties:
android.enableAapt2=false

Step 1: Integrating the SDK

Step 1.1: Add the Required Libraries

Option 1: Pulling the Latest SDK via JCenter

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

  1. Include JCenter in your top-level build.gradle file
    allprojects {
        repositories {
            jcenter()
        }
    }
    		
  2. Add the following line to the dependencies element in your application module’s build.gradle file.

    For Audience Bidder:

    implementation 'com.inmobi.monetization:inmobi-AB-plugin-mopub:1.0.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

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

Add the following files to the app/lib folder within your project.

libs/InMobiSDK.aar
libs/InMobiMediationSDK.aar
	

In case you’re integrating with InMobi Audience Bidding solution, you'll need an additional aar file (InMobiABMoPubPlugin-x.x.x.aar). It can be found out under dist/MoPub/network-support/MoPub/AudienceBidder.

These resources can all be found in the download along with the InMobi SDK.

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'])
	

The SDK bundle contains all media adapters that we support. Prune the downloaded folder to retain the media adapters you need.

Warning: Please remove all older versions of the InMobi SDK (8.X.X and older) and all older versions of the AerServ SDK. Otherwise, your code will not compile! Please reach out to your account manager if you have any questions.

Warning: Using any other version of these SDKs may cause issues and unintended behavior.

Adding and Verifying the Dependencies

To monetize with the InMobi Ad 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 lines 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.0.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 'com.android.support:customtabs:28.0.0'
    		
  2. Sync your Gradle project to ensure dependencies are included.

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'
    		

Note: 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 do so, 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 do so, add the following line to the application module’s dependency element in the Gradle build script.

implementation 'com.android.support:recyclerview-v7:27.1.0'
	

Note: 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 mark your application as multidex enabled:
    defaultConfig {
                applicationId "com.inmobi.samples"
                minSdkVersion 15
                targetSdkVersion 29 
                versionCode 1
                versionName "1.0.0"
                multiDexEnabled true // add this to enable multi-dex
            }
    		
  2. Add the following line to the dependencies element in your application module’s build script.
    compile 'com.android.support:multidex:1.0.3'
    		

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

android {
  defaultConfig { 
  }
  buildTypes {
    ...
  }
  sourceSets {
    main {
    }
  }
}
repositories {
  ...
}
dependencies {
  implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
  implementation 'com.google.android.gms:play-services-location:17.0.0'//optional dependency for better targeting
  implementation 'com.android.support:customtabs:28.0.0'
  implementation 'com.squareup.picasso:picasso:2.71828'
  implementation 'com.android.support:support-v4:28.0.0'
  implementation 'com.android.support:recyclerview-v7:27.1.0'
}
	

Step 1.2: Android Manifest

Add the following Android permission into your Android Manifest:

<?xml version='1.0' encoding='utf-8'?>
<manifest xmlns:android='http://schemas.android.com/apk/res/android'  
  package='com.sample.myapp' >
  <!-- Optional Permissions -->
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <application
    android:allowBackup='true'
    android:label='@string/app_name'>
  </application>  
</manifest>
	

Note: Not including the optional permission MAY negatively impact fill for the respective networks that use these permissions.

Important Prerequisites

  • Checkpoint 1: Preparing Your App for Android 10

    InMobi SDK is compatible with Android 10 (API level 29), the latest version of the Android platform. On Android P onwards, apps make connections over HTTPS by default. Though InMobi supports the adoption of HTTPS, the current setup requires our demand partners to support HTTPS as well. The publisher can change their settings to HTTP if it has an impact on the revenue potential.

  • Checkpoint 2: Preparing Your App for AndroidX

    InMobi SDK is compatible with AndroidX (JetPack) library. In case your app uses the AndroidX library, then follow the standard guidelines by Google for migration by adding both the flags in build file.

    android.useAndroidX=true
    android.enableJetifier=true
    		

Note: 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.

Step 1.3: Integrating MoPub Plugin

Step 1.3.1: Audience Bidding

Note: Contact your account manager for Audience Bidding placement setup.

To use the InMobi Audience Bidding SDK, here is how you can expect the flow to go:

  • The InMobi Audience Bidder SDK will make an ad request and return a bid token
  • The bid token from the ad network will have an updated MoPub Ad Object and have pricing keywords attached
  • You then call loadAd() on the MoPub ad object as before
  • If InMobi is selected to fill, The InMobi Audience Bidder SDK will handle the rendering

Optionally, if you would like to handle the keywords yourself, you may also observe the below flow:

  1. The InMobi Audience Bidder SDK will make an ad request and return a bid token
  2. The bid token from the ad network will have an IMABBidResponse object
  3. You may query the object for the bid keyword, price, granular keyword, InMobi placement, and buyer
  4. You would then append the bid keyword to MoPub's Adview
  5. You would then call loadAd() on the DFP ad object as before
  6. If InMobi is selected to fill, The InMobi Audience Bidder SDK will handle the rendering

Step 1.3.1.1: Enabling Audience Bidding Setup on MoPub

To enable Audience Bidding, you will need to do 2 things:

  1. Set up the line item to use the specific keywords with pricing used by the IMAudienceBidder class.
  2. Update your existing MoPub implementation.
Step 1.3.1.1.1: Setting Up the MoPub Line Items

Option 1 (Setting up Line Items Manually)
  1. Click on Orders -> Create Order
  2. Create a new order
    • Give your order a name (ex. Audience_Bidding_Test)
    • Enter in an advertiser name (ex. InMobi)
  3. Line item type
    • Give your line item a name (ex.IMAB_Banner_0.50)
    • Select type: Network Line Item
    • Select Network: Custom SDK network
    • Custom event class:
      • Banner: com.inmobi.plugin.mopub.IMABCustomEventBanner
      • Interstitial: com.inmobi.plugin.mopub.IMABCustomEventInterstitial
    • Custom event data: {}
    • Under "Budget & schedule", please enter the rate that matches what you have set up on your InMobi + AerServ dashboard for your eCPM (ex. 0.50)
  4. Ad unit targeting
    • Select the app and ad unit for your line item
  5. Audience Targeting
Enter the keyword in the "Keyword targeting" in this format IMAB:0.00 (ex. IMAB:0.50)

eCPM

Keyword

eCPM

Keyword

0.01 IMAB:0.01 5.00 IMAB:5.00
0.05 IMAB:0.05 6.00 IMAB:6.00
0.10 IMAB:0.10 7.00 IMAB:7.00
0.20 IMAB:0.20 8.00 IMAB:8.00
0.30 IMAB:0.30 9.00 IMAB:9.00
0.40 IMAB:0.40 10.00 IMAB:10.00
0.50 IMAB:0.50 11.00 IMAB:11.00
0.60 IMAB:0.60 12.00 IMAB:12.00
0.70 IMAB:0.70 13.00 IMAB:13.00
0.80 IMAB:0.80 14.00 IMAB:14.00
0.90 IMAB:0.90 15.00 IMAB:15.00
1.00 IMAB:1.00 16.00 IMAB:16.00
1.10 IMAB:1.10 17.00 IMAB:17.00
1.20 IMAB:1.20 18.00 IMAB:18.00
1.30 IMAB:1.30 19.00 IMAB:19.00
1.40 IMAB:1.40 20.00 IMAB:20.00
1.50 IMAB:1.50 21.00 IMAB:21.00
1.60 IMAB:1.60 22.00 IMAB:22.00
1.70 IMAB:1.70 23.00 IMAB:23.00
1.80 IMAB:1.80 24.00 IMAB:24.00
1.90 IMAB:1.90 25.00 IMAB:25.00
2.00 IMAB:2.00 26.00 IMAB:26.00
2.50 IMAB:2.50 27.00 IMAB:27.00
3.00 IMAB:3.00 28.00 IMAB:28.00
3.50 IMAB:3.50 29.00 IMAB:29.00
4.00 IMAB:4.00 30.00 IMAB:30.00
Option 2 (Setting up Line Items with an Automated Script)

Add a Chrome extension to your browser. Download extension here.

  1. Login to the MoPub Dashboard
  2. Create your order
  3. Create the first line item under the order
    • Line Item Setup:
      • Type & Priority: Network Line Item
      • Network: Custom SDK Network
      • Custom Event Class:
        • Banner: com.inmobi.plugin.mopub.IMABCustomEventBanner
        • Interstitial: com.inmobi.plugin.mopub.IMABCustomEventInterstitial
      • Example:

      • Under the "Audience Targeting" section:
        • Please enter a keyword in this format: IMAB:0.01
        • Example:

  4. Staying on the current tab, open the extension.
  5. Input the order name and the first line item name
  6. Click 'Run' to execute
  7. Wait for all the line items to be created
Step 1.3.1.1.2: Technical Integration Details for Audience Bidding

For the InMobi Audience Bidding solution, here are the required changes that we'll need to do in our code:

  • Integration Step 1: Add additional imports

Our IMAudienceBidder will have most the necessary classes you'll need for working with our bidder.

import com.inmobi.plugin.mopub.IMAudienceBidder;
	
  • Integration Step 2: Initialize MoPub SDK

Remember to initialize the MoPub SDK. If you don't initialize, your application may not work as intended.

MoPub.initializeSdk(this, sdkConfiguration, initSdkListener());
	
  • Integration Step 3: Initialize the InMobi Audience Bidder

You MUST initialize the InMobi Audience Bidder before you make an ad request. We recommend that you invoke this initialization routine and wait for the completion callback before you intend to show your first ad. The initialize method will take in the current context, your application site ID (from the InMobi platform) and a completion listener. If you have problems finding this information, reach out to your account manager.

InMobiAudienceBidder.initialize(this, IMAB_SITE_ID,new SdkInitializationListener() {
            @Override
            public void onInitializationComplete(@Nullable Error error) {
                if (null != error) {
                    Log.e(TAG, "Init failed with error message : " + error.getMessage());
                } else {
                    Log.d(TAG, "Init Successful");
                }
            }
        });
	

You may also initialize the InMobi Audience Bidder SDK with a GDPR consent object.

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();
}
InMobiAudienceBidder.initialize(this, IMAB_SITE_ID, consentObject,new SdkInitializationListener() {
            @Override
            public void onInitializationComplete(@Nullable Error error) {
                if (null != error) {
                    Log.e(TAG, Init failed with error message : " + error.getMessage());
                } else {
                    Log.d(TAG, "Init Successful");
                }
            }
        });
	
  • Integration Step 4: Get the singleton instance of the IMAudienceBidder

Our IMAudienceBidder class will power the majority of the bidding functionality.

IMAudienceBidder inMobiAudienceBidder = IMAudienceBidder.getInstance();
	
  • Integration Step 5: Create a BidToken for later

To easily support banner refresh and subsequent ad requests for the InMobi Audience Bidder, InMobi provides a BidToken that you may use. InMobi recommends retaining a reference to this. Our bid methods will return this BidToken which you can then call our refreshBid on. Our bid token constructor will require you to pass in an InMobi placement (PLC). Contact your InMobi account manager if you have any questions about this.

private IMAudienceBidder.BidToken bidToken;
	
  • Integration Step 6: Make an Ad request using the BidToken

This step can be broken down into a couple smaller parts. Full example snippets for banner and interstitial is available below.

  • Ensure that your moPubView/MoPubInterstitial has already been constructed.
  • The banner bidder has a constructor method that will accept the current context, InMobi banner placement, MoPubView, and a listener (IMAudienceBidderBannerListener)
  • The interstitial bidder has a constructor method that will accept the current context, InMobi interstitial placement, MoPubInterstitial, and a listener(IMAudienceBidderInterstitialListener)
  • You may define multiple bidTokens.
  • Both banner and interstitial listeners will define a onBidReceived and onBidFailed callback method that must be implemented.

Option A: If you would like for InMobi to handle the keywords (thus simplifying your integration), implement the IMAudienceBidderBannerListener or IMAudienceBidderInterstitialListener interface

  • For onBidReceived (meaning a bid was received from the InMobi Audience Bidder), you get returned an updated MoPub ad object. You then may call load()/loadAd() on this updated MoPub ad object.
  • For onBidFailed (meaning InMobi Audience Bidder failed to give a bid), you get returned a reference of the MoPub ad object with unmodified keywords. You then may call loadAd() on this MoPub ad object.

Option B: If you would like to handle the keywords yourself instead, you may instead implement the IMAudienceBidderBannerKeywordListener / IMAudienceBidderInterstitialKeywordListener interface. In addition, you will have to call setLocalExtras on the MoPub ad view.

  • For onBidReceived (meaning a bid was received from the InMobi Audience Bidder), you get returned a IMABBidResponse. You can then retrieve the following pieces of information from the IMABBidResponse:
    1. getPlacement() - Returns a String that describes the InMobi placement
    2. getBuyer() - Returns a String that describes the buyer
    3. getPrice() - Returns a Double that describes the price
    4. getBidKeyword() - Returns a String that describes a keyword that should be provided to the MoPub ad object
    5. getGranularKeyword() - Returns a String that describes a granular keyword
  • For onBidFailed (meaning InMobi Audience Bidder failed to give a bid), you get returned an error. You then can call loadAd() on the original MoPub ad object.

Banner Code Examples

Option A: InMobi will handle the keywords for you in this snippet.

// Use a Boolean to keep track so we don't call loadAd() on the banner repeatedly.
public Boolean bannerLoaded = false;
bannerBidToken = inMobiAudienceBidder.createBidToken(this, AB_BannerPLC, mopubViewWidth,
mopubViewHeight, moPubView, new IMAudienceBidder.IMAudienceBidderBannerListener() {
@Override
public void onBidReceived(@NonNull final MoPubView m) {
    // Bid was received from InMobi Audience Bidder. Call loadAd() on the updated ad object.
    // If the banner has not yet been loaded, call loadAd() to load the ad into the view
    if (!bannerLoaded) {
        m.loadAd();
    }
}
@Override
public void onBidFailed(@NonNull MoPubView m, @NonNull final Error error) {
    // No Bid received from InMobi Audience Bidder. Call loadAd() on the ad object.
    // If the banner has not yet been loaded, call loadAd() on the updated ad view
    if (!bannerLoaded) {
        m.loadAd();
    }
}
});
// Call update bid to start this process
bannerBidToken.updateBid();
});
	

Option B: You will handle the keywords in this example. You will need to ensure mopub's adview localExtras is not null first. Below is an example of what you might do in your banner configuration code.

Map localExtras = new HashMap();
localExtras.put(IMAudienceBidder.AD_KEY, AB_BannerPLC);
moPubView.setLocalExtras(localExtras);
	

The key difference with this integration path is that you'll need to call setKeywords() yourself by retrieving the value from the IMABBidResponse.

// Use a Boolean to keep track so we don't call loadAd() on the banner repeatedly.
public Boolean bannerLoaded = false;
bannerBidToken = inMobiAudienceBidder.createBidToken(this, AB_BannerPLC, mopubViewWidth, mopubViewHeight, new IMAudienceBidder.IMAudienceBidderBannerKeywordListener() {
  @Override
  public void onBidReceived(IMAudienceBidder.IMABBidResponse imabBidResponse) {
      // Bid was received from InMobi Audience Bidder.
      // Parse the imaBidResponse for any additional information you need, and set them here as desired.
         moPubView.setKeywords(imabBidResponse.getBidKeyword());
      // If the banner has not yet been loaded, call loadAd to load the ad into the view
      if (!bannerLoaded) {
          moPubView.loadAd();
      }
  }
  @Override
  public void onBidFailed(Error error) {
      // No Bid received from InMobi Audience Bidder. Call loadAd on your MoPub view once you are ready.
      // Error handling here as desired
      // If the banner has not yet been loaded, call loadAd to load the ad into the view
      if (!bannerLoaded) {
          moPubView.loadAd();
      }
  }
});
// Call update bid to start this process
bannerBidToken.updateBid();
	

For more information about MoPub banner implementation specifics, you can consult the relevant MoPub documentation here: https://developers.mopub.com/docs/android/banner/

Interstitial Code Examples

Option A: InMobi will handle the keywords for you in this snippet.

interstitialBidToken = inMobiAudienceBidder.createBidToken(Activity.this,
AB_InterstitialPLC, mInterstitial, new IMAudienceBidder.IMAudienceBidderInterstitialListener() {
    @Override
    public void onBidReceived(@NonNull final MoPubInterstitial m) {
        // Bid was received from InMobi Audience Bidder. You may call load() on the updated ad object.
        m.load();
    }
    @Override
    public void onBidFailed(@NonNull MoPubInterstitial m, @NonNull final Error error) {
        // No Bid received from InMobi Audience Bidder. You may call load() on the ad object.
        m.load();
    }
    // Then, call update bid to kick off the bidding process
    interstitialBidToken.updateBid();
});
	

Option B: You will handle the keywords in this example. You will need to ensure mopub's adview localExtras is not null first. Below is an example of what you might do in your interstitial configuration code.

Map localExtras = new HashMap();
localExtras.put(IMAudienceBidder.AD_KEY, AB_InterstitialPLC);
mInterstitial.setLocalExtras(localExtras);
	

The key difference with this integration path is that you'll need to call setKeywords() yourself by retrieving the value from the IMABBidResponse.

interstitialBidToken = inMobiAudienceBidder.createBidToken(this, AB_InterstitialPLC, new IMAudienceBidder.IMAudienceBidderInterstitialKeywordListener() {
  @Override
  public void onBidReceived(IMAudienceBidder.IMABBidResponse imabBidResponse) {
      // Bid was received from InMobi Audience Bidder.
      // Parse the imaBidResponse for any additional information you need, and set them here as desired.
      mInterstitial.setKeywords(imabBidResponse.getBidKeyword());
      // Call load on the interstitial after all keywords have been set
      mInterstitial.load();
  }
  @Override
  public void onBidFailed(Error error) {
      // No bid received - you may call load on the interstitial after any additional keywords have been set
      // Error handling here as desired
      mInterstitial.load();
  }
});
// Then, call update bid to kick off the bidding process
interstitialBidToken.updateBid();
	

Remember to then show the interstitial! Consult MoPub documentation here regarding interstitials: https://developers.mopub.com/docs/android/interstitial/

public void onInterstitialLoaded(MoPubInterstitial interstitial) {
    if (interstitial.isReady()){  
       interstitial.show();  
    }
}
	
  • Integration Step 7: Implement Banner Callbacks to Support Banner Refresh

InMobi supports MoPub's automatic banner refresh in the InMobi Audience Bidder SDK through MoPub Plugin SDK. You'll need to include an updateBid method call in the MoPub onBannerLoaded / onBannerFailed. This will allow us to provide a fresh bid each time the banner is refreshed.

public void onBannerLoaded(MoPubView banner) {
    // Ensure that we do not call loadAd() again on the MoPubView
    bannerLoaded = true;
    // Update the bid for the next MoPub refresh ad call
    bannerBidToken.updateBid();
}
public void onBannerFailed(MoPubView banner, MoPubErrorCode errorCode) {
    // Ensure that we do not call loadAd() again on the MoPubView
    bannerLoaded = true;
    // Update the bid for the next MoPub refresh ad call
    bannerBidToken.updateBid();
}
	
  • Integration Step 8: Re-use the interstitial bid token

You can also re-use the interstitial bid token. As an example, you might include this in the onInterstitialDismissed callback from MoPub.

// Update bid for the next ad call
interstitialBidToken.updateBid();
	
  • Step 1.3.1.1.3: Testing your Audience Bidding Integration

In order to test your Audience Bidding implementation, you will need to:

  • Make sure you enable test mode on your placement through the UI
  • Set up a line item with
    • CPM 0.00
    • Keyword: IMAB:0.00
  • Two ways to verify:
    • Through Charles:
      • In the ad request we send to Mopub (ads.mopub.com/m/ad), check under "Contents" & "JSON Text".

        You should see a key value pair of: "q: keywords, testing, IMAB:0.00"

    • Through Mopub Reporting:
      1. Make sure the ad filled on testing
      2. Make sure the numbers align for the newly generated line item at $0.00 (it might take a few minutes for Mopub to report it).

Version History

SDK 9.0

  • 9.0.4: 3/3/20
    • 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)

  • 9.0.2: 2/27/20
    • 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

  • 9.0.1: 10/25/19
    • 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
  • 9.0.0: 9/20/19
    • Modular SDK

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

    • Added support for Android 10
    • Support for Mopub 5.8
    • Interface Changes through APIs
    • Bug fixes and performance improvements
  • 8.2.1: 8/22/19
    • Bug Fixes for SDK and AudienceBidder Plugin
  • 8.2.0: 8/5/19
    • Chrome Custom tabs support
    • Thread Optimizations
    • Bug Fixes for SDK and AudienceBidder Plugin
  • 8.1.3: 7/18/19
    • Support for Audience Bidding for DFP
    • Bug Fixes
  • 8.1.2: 6/19/19
    • Updated AdColony SDK support to 3.3.10
    • Updated Audience Network (Facebook) support to 5.3.1
  • 8.1.1: 5/27/19
    • Support for new Picasso version 2.71828
    • Bug Fixes
  • 8.1.0: 5/14/19
    • DFP Plugin Support
    • Mopub Audience Bidding Plugin Keyword Handling
  • 8.0.9: 4/22/19
    • Bug Fixes
  • 8.0.8: 4/17/19
    • Bug Fixes
  • 8.0.7: 4/5/19
    • Bug Fixes
    • Updated AudienceBidder to v1.0.1
      • Support for granular keywords
      • Fixed issue with updateBid not working with MoPub's refresh
      • Replaced source file with a aar
      • Various API Changes (see documentation)
  • 8.0.5: 3/11/19
    • Audience Bidder for the Mopub Plugin
    • Telaria Adapter Deprecation
    • Flurry Banner Adapter Deprecation
    • Applovin 3rd Party API Reporting updates
    • Chartboost 3rd Party API Reporting updates
    • Mediated SDK updates
    • Bug Fixes
  • 8.0.1: 11/28/18
    • Unified InMobi + AerServ SDK

exchange | Audience bidding for Custom Mediation (Android)

The Audience Bidding Android SDK integration guide (available here) will help you with the following:

  • Adding the InMobi SDK to your Project
  • Adding and Verifying the Dependencies
  • Changing the Manifest file
  • Preparing your App for Android N+
  • Initializing the InMobi SDK

Once you have added the SDK successfully, please follow the steps below to load the following ad units using Audience Bidding.

  1. Banner Ads
  2. Interstitial Ads

Banner Ads

Step 1: Setting up a Banner Ad

To display a banner ad on your app, you would first need to create a banner placement ID. After adding your app, select BANNER AD to create a placement for the ad type - Banner. Once you create the banner placement, the placement ID is available.

Step 2: Adding a Banner Ad to your App

Creating a Banner Ad

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

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

Notes:

  • 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
Set Banner Ad size

To set the banner size in Android code, write the following code:

    bannerAd.setBannerSize(, );
    

Step 3: Requesting for Bid

Requesting for a bid requires you to set the size of the Banner ad before requesting for a bid on the InMobiBanner instance. Once you have set the size of InMobiBanner ad, you can call the InMobiBanner#getPreloadManager()#preload() method on the instance you just created to request for a bid.

    /**
    * A sample code to request bid
    */
    public class YourActivity {
    private InMobiBanner banner;
        public void requestBid() {
        banner.setListener(new BannerAdEventListener() {
                /**
                * 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
            */
                @Override
                public void onAdFetchSuccessful(@NonNull InMobiBanner ad, @NonNull AdMetaInfo info) {
                    double bid = info.getBid();
                    Log.d(TAG, "Bid received : " + bid);
                }
            /**
                * Called to notify that an ad preload has failed. 

Note This * notification is given only when you use {@code preload()} in * {@link InMobiBanner#getPreloadManager()}

* * @param ad Represents the ad which was preloaded * @param status Represents the {@link InMobiAdRequestStatus} status containing error reason */ @Override public void onAdFetchFailed(@NonNull InMobiBanner ad, @NonNull InMobiAdRequestStatus status) { Log.d(TAG, "Bid fetch failure : " + status.getMessage()); } }); // Step to preload banner banner.getPreloadManager().preload(); } }

Note:

You’ve to maintain this banner instance for loading the ad later, in case InMobi won the auction.

Step 4: Loading the Banner Ad

In case InMobi has won the auction, then you can call the InMobiBanner#getPreloadManager()#load() method on the instance to load the ad.

    /**
    * A sample code to load ad
    */
    public class InMobiCustomEvent {
        private InMobiBanner banner;
        /**
        * A sample load method for your PPM
        */
        @Override
        protected void loadBanner() {
            // Custom event load, publisher to hold InMobiBanner object
            this.banner.setListener(new BannerAdEventListener() {
            /**
                * Called to notify that an ad was successfully loaded and is ready to be displayed.
                *
                * @param ad   Represents the ad which was loaded
                * @param info Represents the ad meta information
            */
                @Override
                public void onAdLoadSucceeded(@NonNull InMobiBanner ad, @NonNull AdMetaInfo info) {
                    Log.d(TAG, "Banner displayed");
                }

                /**
                    * Called to notify that a request to load an ad failed.
                    *
                    * @param ad     Represents the ad which failed to load
                    * @param status Represents the {@link InMobiAdRequestStatus} status containing error reason
                */
                @Override
                public void onAdLoadFailed(@NonNull InMobiBanner ad, InMobiAdRequestStatus status) {
                    Log.d(TAG, "Banner display failed");
                }
            });
            this.banner.getPreloadManager().load();
        }

        // Other code
    }
    

Interstitial Ads

Step 1: Setting up an Interstitial Ad

  1. To display an Interstitial ad, you need an interstitial placement ID.
  2. After adding your app, select INTERSTITIAL AD to create a placement for ad type Interstitial.
  3. Once you successfully create the placement, the placement ID is available.

Step 2: Adding an Interstitial Ad to your App

Creating an Interstitial Ad

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

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

Notes:

  • 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

Step 3: Requesting for Bid

Requesting for a bid requires you to call the API InMobiInterstitial#getPreloadManager()#preload() method on the instance you just created to request for a bid.

/**
* A sample code to request bid
*/
public class YourActivity {
    private InMobiInterstitial interstitial;

   public void requestBid() {
       interstitial = new InMobiInterstitial(context, , new InterstitialAdEventListener() {
                    /**
                    * Called to notify that an ad was successfully loaded.
                    * @param ad Represents the {@link InMobiInterstitial} ad which was loaded
                    * @param info Represents the ad meta information
                    */
                    @Override
                    public void onAdFetchSuccessful(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info) {
                        double bid = info.getBid();
                        Log.d(TAG, "Bid received : " + bid);
                    }
                    /**
                    * Called to notify that an ad preload has failed. 

Note This * notification is given only when you use {@code preload()} in * {@link InMobiInterstitial#getPreloadManager()}

* * @param ad Represents the ad which was preloaded * @param status Represents the {@link InMobiAdRequestStatus} status containing error reason */ @Override public void onAdFetchFailed(@NonNull InMobiInterstitial ad, @NonNull InMobiAdRequestStatus status) { Log.d(TAG, "Bid fetch failure : " + status.getMessage()); } }); // Step to preload interstitial interstitial.getPreloadManager().preload(); } }

Note:

You’ve to maintain this interstitial instance for loading the ad later, in case InMobi won the auction.

Step 4: Loading & Showing the Interstitial Ad

In case InMobi has won the auction, then you can call the InMobiInterstitial#getPreloadManager()#load() method on the instance to load the ad followed by InMobiInterstitial#show() to show the ad.

/**
* A sample code to load ad
*/
public class InMobiCustomEvent {
    private InMobiInterstitial interstitial;
    /**
    * A sample load method for your PPM
    */
    @Override
    protected void loadInterstitial() {
            // Custom event load, publisher to hold InMobiInterstitial object
            interstitial.setListener(new InterstitialAdEventListener() {
                /**
                * Called to notify that an ad was successfully loaded and is ready to be displayed.
                *
                * @param ad   Represents the ad which was loaded
                * @param info Represents the ad meta information
               */
                @Override
                public void onAdLoadSucceeded(@NonNull InMobiInterstitial ad, @NonNull AdMetaInfo info) {
                     Log.d(TAG, "Interstitial loaded");
                }

               /**
                * Called to notify that a request to load an ad failed.
                *
                * @param ad     Represents the ad which failed to load
                * @param status Represents the {@link InMobiAdRequestStatus} status containing error reason
               */
                @Override
                public void onAdLoadFailed(@NonNull InMobiInterstitial ad, @NonNull InMobiAdRequestStatus status) {
                    Log.d(TAG, "Interstitial load failed");
                }
        });
        this.interstitial.getPreloadManager().load();
   }
    /**
    * A sample show method for your PPM
    */
    @Override
    protected void showInterstitial() {
        if (this.interstitial.isReady()) {
            this.interstitial.show();
        }
    }
    // Other code
}

exchange | Setting up Applovin as an ad source

Ad Source Details:

How to Set Up the AppLovin Ad Source

Step 1: Log on to http://platform.aerserv.com/ and click on the Ad Sourceslink at the top of the page.

Step 2: Click the + or theAdd New Ad Source button on the page.

Step 3: Enter a Name for the ad source(example:AppLovin Interstitial).

Step 4: Select AppLovin as the ad source.

Step 5: Enter the following fields that are specific to the AppLovin ad source:

FIELD DESCRIPTION REQUIRED/OPTIONAL EXAMPLE
SDK Key SDK Key from AppLovin Required

kNwmy2TTapU1laErKATpnlVvL4UpPNQ

7mLuhOLAz8e_uEDkTOGM9_s3LxX8K

wZRgwKMIfXGpBFgPTPzsfJ_fA2

Preload Sizes Leaving field blank defaults to "Banner, Inter" Required Banner
Preload Types Leaving field blank defaults to "Regular, Video" Required Regular
Verbose Logging To view the debug log from AppLovin SDK Required Yes

Step 6: Enter aCPM (example:3.50)

Step 7: Select a placement(s) to assign this ad source to

Step 8: Select any desired geo or device targeting

Step 9: Click the Save button

Step 10: Download the AerServ SDK

Locating the AppLovin SDK Key

  1. Log on to the AppLovin Platform and click on Account
  2. Click the Keys tab on the left hand side
  3. Copy the ApplovinSDKkeys value in the SDK Key field and paste it to the ApplovinSDKkeys field on the AerServ platform

NOTE: We recommend leaving both fields blank on the AerServ UI.

Android

Step 1. Locate the AppLovinfilesinside network-support/AppLovin/

Step 2. Add applovin-sdk-6.x.x.jar to your app's lib folder, i.e. [Project Name]/app/libs

Step 3. Add the following permissions to your AndroidManifest.xml:

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

Step 4. Add the following activities to your AndroidManifest.xml:

      <activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
      <activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />

iOS

Step 1. Add the AppLovinSDK in the folder network-support/AppLovin/AppLovinSDK.framework into your project frameworks.

Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:

      AppLovin.framework
      AdSupport.framework
      AVFoundation.framework
      CoreGraphics.framework
      CoreMedia.framework
      CoreTelephony.framework
      StoreKit.framework
      SystemConfiguration.framework
      UIKit.framework
	

exchange | Setting up Adcolony as an ad source

Ad Source Details:

How to Set Up AdColony as an Ad Source

Step 1: Log on to http://platform.aerserv.com/ and click on the Ad Sources link at the top of the page.

Step 2: Click the + or the Add New Ad Source button on the page

Step 3: Enter a Name for the ad source(example:AdColonyInterstitial)

Step 4: Select AdColony as the ad source

Step 5: Enter the following fields that are specific to the AdColony ad source:

FIELD DESCRIPTION REQUIRED/OPTIONAL EXAMPLE
Application ID The Application ID assigned by AdColony Required app185a7e71e1714831a49ec7
Zone ID A comma separated list of zone IDs Required vz06e8c32a037749699e7050, vz06e8c32a037749699e7050

Step 6:Enter aCPM (example:3.50)

Step 7: Select a placement(s) to assign this ad source to

Step 8: Select any desired geo or device targeting

Step 9: Click the Save button

Step 10: Download the AerServ SDK

Android

Step 1. Locate the AdColony filesinside network-support/Adcolony/

Step 2. Add adcolony.jar to your app's lib folder, i.e. [Project Name]/app/libs

Step 3. Add the following folders to your app's lib folder as necessary:

armeabi, armeabi-v7a, arm64-v8a, x86_64, and x86

Step 4. Add the following settings inside your application's build.gradle:

  android {
...
    sourceSets {
        main{
            jniLibs.srcDirs = ['libs']
        }
    }
}
...
dependencies {
    compile 'com.google.android.gms:play-services-ads:10.0.1'
    compile 'com.android.support:support-annotations:25.0.1'
}

Step 5. Add the following permissions to your AndroidManifest.xml:

<!-- Required by AdColony --><br>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <br>
<br>

<!-- Optional, but Recommended by AdColony --><br>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />

Step 6. Add the following activityto your AndroidManifest.xml:

  <activity 
  android:name="com.adcolony.sdk.AdColonyInterstitialActivity"
  android:configChanges="keyboardHidden|orientation|screenSize"
  android:hardwareAccelerated="true"/>
<activity 
  android:name="com.adcolony.sdk.AdColonyAdViewActivity"
  android:configChanges="keyboardHidden|orientation|screenSize"
  android:hardwareAccelerated="true"/>

iOS

Step 1. Add the Adcolony SDK in the folder network-support/AdColony/AdColony.framework into your project frameworks.

  • Open Target > General > Under Deployment Info and for Device Orientation, check Portrait, Upside Down, Landscape Left, and Landscape Right
  • Open Target > Build Settings > Under Architectures, confirm that your Xcode project uses Base SDK version 9.0 or greater and that it does not use the armv6 architecture
  • Open Target > Build Settings > Under Linking, add -fobjc-arc to Other Linker Flags

Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:

libz.1.2.5.tbd
AdColony.framework
AdSupport.framework
AudioToolbox.framework
AVFoundation.framework
CoreMedia.framework
CoreTelephony.framework
JavaScriptCore.framework
MessageUI.framework
MobileCoreServices.framework
SafariServices.framework (Set to Optional)
Social.framework (Set to Optional)
StoreKit.framework (Set to Optional)
SystemConfiguration.framework
WatchConnectivity.framework (Set to Optional)
WebKit.framework (Set to Optional)
	

Step 2. Add the following entry into your info.plist:

<key>NSCalendarsUsageDescription</key>
<string>Some ad content may create a calendar event.</string>
<key>NSMotionUsageDescription</key>
<string>Some ad content may require access to accelerometer for interactive ad experience.</string>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fb</string>
    <string>instagram</string>
    <string>tumblr</string>
    <string>twitter</string>
</array>
	

exchange | Interstitial Ads

Interstitial ads are full page ads placed at natural break points in the app flow. With 10 times the real estate compared to banner ads, Interstitial ads are guaranteed to catch your users' eyes and drive higher revenue for your mobile business!


Follow these steps to start monetizing with Interstitial ads:

  1. Setting up an Interstitial Ad in the UI
  2. Creating an Interstitial Ad
  3. Testing the Integration

Step 1. Setting up an Interstitial Ad in the UI

  1. Go to the Inventory tab in the nav bar and press + next to the app you want to add your Interstitial ad placement to.

  2. Select Add Placement in the aerWall (Rewarded or Non-Rewarded) placement section.

    Note: The UI enables you to add multiple placements in step 2 before continuing to step 3.

  3. Fill in the details in the following fields. Some of them are optional. Read the descriptions to understand the functionality of each field:
    • Name - A unique name that will help identify this placement.
    • Ad Type: Determines the types of creatives that can be shown in the placement.
    • Skippable: A flag that indicates if the video ad can be skipped.
    • Skip Duration: Specifies the time in seconds when the skip button will appear in the interstitial.
    • Video Duration: Specifies the video lengths that can be returned to a placement.
    • Default Video to Mute: A flag that indicates if the video should start with sound off. Checking this box indicates that the video should be muted while starting.
    • Frequency Cap - Limits the amount of times an ad can be delivered to a specific user in a given duration.
    • COPPA Compliance - A flag to determine if the section of the app where this placement resides, needs to be COPPA compliant. Checking this box indicates that the placement needs COPPA compliance.
    • Ad Mode - This toggle will enable display of test ads on your placement.

      WARNING: If enabled, the placement will only show test ads. These test ads do not have revenue associated with them and should be used strictly for testing purposes.

    • It’s an Audience Bidder Placement - This field should remain unchecked and is not relevant to the Windows SDK.

Step 2. Creating an Interstitial Ad

The InMobi SDK provides a programmatic instantiation of the Interstitial ad.

Let's take a look at the steps required to create and show an Interstitial ad.

  1. Import the header and create an Interstitial:

    Import the InMobi.Ads header, and declare an instance of IMInterstitial.

    It should look similar to the below code snippet:

    using InMobi.Ads;
    // <additional headers here>
    namespace <namespace_here> {
    		public sealed partial class AdRequestTesting: Page {
    		    private IMInterstitial interstitial;
            // rest of your code below
        }
    }
    		
  2. Instantiate the Interstitial object:

    The Interstitial object can be instantiated with the following method provided in the IMInterstitial class:

    public IMInterstitial(string placementId)
    		

    Param Definitions::

    1. placementId: A placement ID is a unique ID that defines a specific place in your application where an ad will be served.
    2. Recommended: You may register the Interstitial to the following events:
      interstitial.OnAdLoadSucceeded += Interstitial_OnAdLoaded;
      interstitial.OnAdLoadFailed += Interstitial_OnAdFailed;
      interstitial.OnAdWillDisplay += Interstitial_OnAdWillDisplay;
      interstitial.OnAdDisplayed += Interstitial_OnAdDisplayed;
      interstitial.OnAdDismissed += Interstitial_OnAdDismissed;
      interstitial.OnAdDisplayFailed += Interstitial_OnAdDisplayFailed;
      interstitial.OnAdInteraction += Interstitial_OnAdInteraction;
      interstitial.OnAdWillLeaveApplication += Interstitial_OnAdWillLeaveApplication;
      interstitial.OnRewardsUnlocked += _Interstitial_onRewardsUnlocked;
      			

      These events are triggered in following situations:

      a. OnAdLoadSucceeded: When the Interstitial ad is fully loaded.

      b. OnAdLoadFailed: When the Interstitial ad has failed to load due to some error.

      c. OnAdWillDisplayed: When the Interstitial ad is about to present full screen content.

      d. OnAdDisplayed: When the ad Interstitial model view has presented the full screen content.

      e. OnAdDismissed: When the Interstitial ad view has been dismissed.

      f. OnAdDisplayFailed: When the Interstitial ad has failed to present due to some error.

      g. OnAdInteraction: When the user interacts with the Interstitial ad. (i.e. click)

      h. OnAdWillLeaveApplication: When the app is about to leave the application after the Interstitial ad is clicked.

      i. OnRewardsUnLocked: When the user has performed the required action to receive the reward.

  3. Loading the Interstitial Ad:

    Displaying an Interstitial ad is a two-step process.

    1. The first step is to call the loadAd method on the IMInterstitial object.
      interstitial.LoadAd();
      			

      Note: The above callback can result in a success or a failure.

    2. If the call was successful, the second step is to call the ShowAd method on the IMInterstitial object to show the ad. An example is demonstrated next:
      private void Interstitial_OnAdLoaded(object sender, string e) {
          interstitial.ShowAd();
      }
      			

      Should the ad call fail for any reason, the failure is reported in the following method:

      private void Interstitial_OnAdFailed(object sender, FailureCode e) {
          // <your code to handle failure state>
      }
      			

      Failure indicates an exception in loading the Interstitial ad. Once a failure is encountered, showing the Interstitial ad is not possible.

Step 3. Testing the Integration

The Banner placement can be set to Test mode in order to test your integration.

Note: The default setting for a placement is Live.

When any placement is in Test mode, the placement will only show test ads.

These test ads do not have revenue associated with them and should be used strictly for testing purposes!

To switch a placement’s Ad Mode:

  • Go to the placement edit page
  • Find the “Ad Mode” toggle and switch to Test
  • Select “Confirm” from the reminder dialogue box.
  • Press “Save” on the placement edit page.
  • Once testing is complete, remember to switch the placement’s “Ad Mode” back to Live to start monetizing the placement.

exchange | Banner Ads

Banner Ads are graphical ads, typically including a combination of static/animated images and text designed to convey a marketing message and/or cause the user to take action. All types of apps can leverage Banner ads for monetization!


Follow these steps to start monetizing with Banner ads:

  1. Setting up a Banner Ad in the UI
  2. Creating a Banner Ad
  3. Testing the Integration

Step 1. Setting up a Banner Ad in the UI

  1. Go to the Inventory tab in the navigation bar and press + next to the app you want to add your Banner ad placement to.
  2. Select Add Placement in the aerBanner placement section.

    Note: The UI enables you to add multiple placements in step 2 before continuing to step 3.

  3. Fill in the details in the following fields. Some of them are optional. Read the descriptions to understand the functionality of each field:
    • Name - A unique name that will help identify this placement.
    • Size - Defines the ad slot size for the placement.
    • Frequency Cap - Limits the amount of times an ad can be delivered to a specific user in a given duration.
    • Refresh Interval - Defines the amount of time a placement will wait before calling for another ad.
    • COPPA Compliance - A flag to determine if the section of the app where this placement resides, needs to be COPPA compliant. Checking this box indicates that the placement needs COPPA compliance.
    • Ad Mode - This toggle will enable display of test ads on your placement.

      WARNING: If enabled, the placement will only show test ads. These test ads do not have revenue associated with them and should be used strictly for testing purposes.

    • It’s an Audience Bidder Placement - This field should remain unchecked and is not relevant to the Windows SDK.

Step 2. Creating a Banner Ad

The IMBanner is simply a subclass of FrameworkElement for displaying HTML ads.

The InMobi Windows SDK provides a programmatic instantiation of the Banner ad.

Let us take a look at the steps required to create and show a Banner ad.

  1. Import the header and create a Banner:

    Import the InMobi.Ads header, and declare an instance of IMBanner.

    Sample Code:

    using InMobi.Ads;
    // <additional headers here>
    namespace <namespace_here> {
        public sealed partial class AdRequestTesting: Page {
            private IMBanner banner;
            // rest of your code below
        }
    }
    		
  2. Instantiate the Banner object:

    The Banner object can be instantiated with following method provided in the IMBanner class:

    public IMBanner(string placementId, IMAdSize size)
    		

    Param Definitions:

    1. placementId: A placement ID is a unique ID that defines a specific place in your application where an ad will be served.
    2. size: It refers to the desired ad slot for the Banner. For more information on sizes, you can refer to the IMAdSize class.

      The following column lists the supported Banner sizes:

      Banner Slot
      Banner300x50
      Banner320x50
      Banner320x100
      Banner640x100
      Leaderboard728x90
      Leaderboard924x50
      Leaderboard924x250
      MedRect300x250
      Skyscraper160x600
      Skyscraper300x600
      Portrait320x480
      Portrait320x568
      Landscape480x320
      Fullscreen1024x728

    Initialize the Banner object in the following format:

    banner = new IMBanner(<placement_id>, <banner_size>);
    		

    Recommended: You may register the Banner to the following events:

    banner.OnAdLoadSucceeded += Banner_OnAdLoaded;
    banner.OnAdLoadFailed += Banner_OnAdFailed;
    banner.OnAdDisplayed += Banner_OnAdDisplayed;
    banner.OnAdDismissed += Banner_OnAdDismissed;
    banner.OnAdInteraction += Banner_OnAdInteraction;
    banner.OnAdWillLeaveApplication += Banner_OnAdWillLeaveApplication;
    		

    These events are triggered in following situations:

    a. OnAdLoadSucceeded: When the Banner ad is fully loaded.

    b. OnAdLoadFailed: When the Banner ad has failed to load due to some error.

    c. OnAdDisplayed: When the Banner ad model view has been presented.

    d. OnAdDismissed: When the Banner ad view has been dismissed.

    e. OnAdInteraction: When the user interacts with the Banner ad. (i.e. click)

    f. OnAdWillLeaveApplication: When the app is about to leave the application after the Banner ad is clicked.

  3. Displaying the Banner ad:

    The Banner ad may be displayed using the following method call:

    banner.LoadAd()
    		
  4. Configuring the Banner Refresh Interval:

    The refresh interval of the Banner object can be controlled using the following property on IMBanner instance.

    public int RefreshInterval
    		

Step 3. Testing the Integration

The Banner placement can be set to Test mode in order to test your integration.

Note: The default setting for a placement is Live.

When any placement is in Test mode, the placement will only show test ads.

These test ads do not have revenue associated with them and should be used strictly for testing purposes!

To switch a placement’s Ad Mode:

  • Go to the placement edit page
  • Find the “Ad Mode” toggle and switch to Test
  • Select “Confirm” from the reminder dialogue box.
  • Press “Save” on the placement edit page.
  • Once testing is complete, remember to switch the placement’s “Ad Mode” back to Live to start monetizing the placement.

exchange | Windows Guidelines

Getting Started with Windows SDK Integration

Integrating and monetizing with InMobi SDK with is easy. This Windows SDK integration guide will help you with the following:

  1. Step 1: Adding the SDK to your Project
  2. Step 2: Initializing the SDK

Step 1: Adding the SDK to your project

Integration via Nuget

  1. In your project in Visual Studio, go to NuGet window by navigating through Tools->NuGet Package Manager -> Manage NuGet Packages For Solution
  2. In the window opened above, search for inmobi. Once InMobi.Ads appears in the search result, select and click on install.

Step 2: Initializing the SDK

  1. Import InMobi SDK in App.xaml.cs as shown below:
    using InMobi.Ads
    			
  2. Initialize the SDK using the following API that is called on IMSDK.Instance:
    InitializeSDK(string appId, IEnumerable<KeyValuePair<string, object>> consentObject)
    			

    In the App.xaml.cs, add the SDK initialization code as shown below:

    protected override void OnLaunched(LaunchActivatedEventArgs e) {
        <Initialization Code>
    	    IMSDK.Instance.InitializeSDK("<appID>", <consentObject>);
    }
    			

    Note: It is important to initialize the SDK within method OnLaunched.

Param Definitions

The app ID is the unique aerserv ID for your App.

consentObject is an enumerable representation of all kinds of consent provided by the publisher to the SDK. The key is mandatory if you wish to monetize traffic from EEA region.

Key Type Inference
gdpr_consent String A consent string is a series of numbers, which identifies the consent status of an Adtech Vendor. The string must follow the IAB contracts as mentioned here.
gdpr_consent_available String

"true": User has provided consent to collect and use data.

"false": User has not provided consent to collect and use data.

Any value other than "true" and "false" is invalid and will be treated as value not provided by user. The key, gdpr_consent_available, can be accessed via string constant IM_GDPR_CONSENT_IAB.

gdpr String Whether or not the request is subjected to GDPR regulations (0 = No, 1 = Yes), omission indicates Unknown.

Important Notes

a. consentObject

  1. consentObject has to be provided in every session. SDK does not persist consent, it only keeps the consentObject in memory. If the app is relaunched, SDK will lose consentObject.
  2. Within a session, consentObject can be retrieved and updated by using getter and setter on the following variable:
    IMSDK.Instance.ConsentObject
    			

b. Probable Initialization Issues

  1. If the SDK fails to initialize, the following message would be printed in the console:
    [IMSDK] IMSDK cannot be initialised due to an exception: <exception details>
    			
  2. Trying to re-initialize an already initialized SDK results in a no-op and the following message would be printed in the console:
    [IMSDK] IMSDK is already initialised, ignoring your call
    			
  3. The current state of initialization of SDK can be queried using bool variable, IsSdkInitialised, on IMSDK.Instance.

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

exchange | GDPR Consent for Third-party SDKs - Android

With Android SDK 902, we have introduced a new API for publishers to pass GDPR consent to various third parties that are part of Aerserv mediation.

public static void setAdapterGdprConsent(@Nullable JSONObject adapterConsentObject)

The consent includes the following partners:

  • ADCOLONY
  • ADMOB
  • APPLOVIN
  • CHARTBOOST
  • FLURRY
  • MILLENNIALMEDIA
  • MOPUB
  • MYTARGET
  • UNITY
  • VUNGLE

Passing the GDPR Consent API

Use the following steps to pass GDPR consent API:

STEP 1: Create a new JSONObject instance as shown below:

		JSONObject adapterConsent = new JSONObject();
	

STEP 2: Add individual consent status for each partner SDK. Refer to the list below for partner-specific list of constants exposed in AdapterConsentKeys. These should be used for passing consent for all listed SDKs.

  1. ADCOLONY:

    Key Type Inference
    KEY_ADCOLONY_GDPR_CONSENT_STRING String Your user's consent string. In this case, the user has given consent to store and process personal information.

    Refer here for more info:

    AS_KEY_ADCOLONY_GDPR_REQUIRED boolean The value passed via setGDPRRequired() will determine the GDPR requirement of the user. If it is true, then the user is subject to the GDPR laws.

    Sample code:

    JSONObject adColony = new JSONObject(); 
    try {
        adColony.put(AdapterConsentKeys.KEY_ADCOLONY_GDPR_REQUIRED, true);
        adColony.put(AdapterConsentKeys.KEY_ADCOLONY_GDPR_CONSENT_STRING, "true");
        adapterConsent.put(AdapterConsentKeys.KEY_ADCOLONY, adColony);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    		
  2. ADMOB:

    Key Type Inference
    KEY_ADMOB_NON_PERSONALIZED_ADS String The default behaviour of the Google Mobile Ads SDK is to serve personalized ads. If a user has consented to receive only non-personalized ads, you can use the below code to request non personalised regardless of whether the user is in the EEA.

    Refer here for more info:

    Sample code:

    JSONObject adMob = new JSONObject();
    try {
        adMob.put(AdapterConsentKeys.KEY_ADMOB_NON_PERSONALIZED_ADS, "1");
        adapterConsent.put(AdapterConsentKeys.KEY_ADMOB, adMob);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    		
  3. APPLOVIN:

    Key Type Inference
    KEY_APPLOVIN_HAS_USER_CONSENT boolean If the user has consented, please set the following key to true else to false.

    Refer here for more info:

    KEY_APPLOVIN_IS_AGE_RESTRICTED_USER boolean To ensure COPPA, GDPR, and Google Play policy compliance, you should indicate when a user is a child. If the user is known to be in an age-restricted category (i.e., under the age of 16) please set the flag to true.

    If the user is known to be not in an age-restricted category (i.e., age 16 or older), please set the flag to false.

    Sample code:

    JSONObject appLovin = new JSONObject(); 
    try { 
        appLovin.put(AdapterConsentKeys.KEY_APPLOVIN_HAS_USER_CONSENT, true);
        appLovin.put(AdapterConsentKeys.KEY_APPLOVIN_IS_AGE_RESTRICITED_USER, true);
        adapterConsent.put(AdapterConsentKeys.KEY_APPLOVIN, appLovin);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    		
  4. CHARTBOOST:

    Key Type Inference
    KEY_CHARTBOOST_PI_DATA_USE_CONSENT Number Set the consent status corresponding to the user's response using the given key.

    Use the number value to represent value of:

    /* Publisher hasn't implemented functionality or the user has the option to not answer. */
    Chartboost.CBPIDataUseConsent.UNKNOWN = -1,
    /* User does not consent to targeting (Contextual ads). */
    Chartboost.CBPIDataUseConsent.NO_BEHAVIORAL  = 0,
    /* User consents (Behavioral and Contextual Ads). */
    Chartboost.CBPIDataUseConsent.YES_BEHAVIORAL = 1
    				

    Refer here for more info:

    Sample code:

    JSONObject chartboost = new JSONObject();
    try {
        chartboost.put(AdapterConsentKeys.KEY_CHARTBOOST_PI_DATA_USE_CONSENT, 1);
        adapterConsent.put(AdapterConsentKeys.KEY_CHARTBOOST, chartboost);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    		
  5. FLURRY:

    Key Type Inference
    KEY_FLURRY_GDPR_SCOPE boolean Key set to true states that GDPR scope apply, while false states that GDPR scope do not apply.
    KEY_FLURRY_CONSENT_STRINGS JSONObject Use this JSONObject to give the value of Consent Strings.

    Refer here for more info:

    Sample code:

    JSONObject flurry = new JSONObject();
    try {
        JSONObject flurryStrings = new JSONObject();
        flurryStrings.put("iab", "<IAB Consent string>");
        flurryStrings.put("consent", "true");
        flurry.put(AdapterConsentKeys.KEY_FLURRY_GDPR_SCOPE, true);
        flurry.put(AdapterConsentKeys.KEY_FLURRY_CONSENT_STRINGS, flurryStrings);
        adapterConsent.put(AdapterConsentKeys.KEY_FLURRY, flurry);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    		
  6. MILENNIALMEDIA:

    Key Type Inference
    KEY_MILLENNIALMEDIA_CONSENT_REQUIRED boolean Set to true if the user falls under GDPR jurisdiction.
    KEY_MILLENNIALMEDIA_CONSENTDATA_IAB String Sets the IAB Consent String.

    Refer here for more info:

    Sample code:

    JSONObject millinealMedia = new JSONObject();
    try {
        millinealMedia.put(AdapterConsentKeys.KEY_MILLENNIALMEDIA_CONSENT_REQUIRED, true);
        millinealMedia.put(AdapterConsentKeys.KEY_MILLENNIALMEDIA_CONSENTDATA_IAB, "true");
        adapterConsent.put(AdapterConsentKeys.KEY_MILLENNIALMEDIA, millinealMedia);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    		
  7. MOPUB:

    Key Type Inference
    KEY_MOPUB_CONSENT boolean Set to true if the user wants to grant consent or false if user wants to revoke consent. This applies only for publisher-owned consent mechanism.

    Refer here for more info:

    Sample code:

    JSONObject mopub = new JSONObject();
    try {
        mopub.put(AdapterConsentKeys.KEY_MOPUB_CONSENT, true);
        adapterConsent.put(AdapterConsentKeys.KEY_MOPUB, mopub);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    		
  8. MYTARGET:

    Key Type Inference
    KEY_MYTARGET_USER_AGERESTRICTED boolean If the user is known to be in an age-restricted category (i.e., under the age of 16) please set the following flag to true.
    KEY_MYTARGET_USER_CONSENT boolean Sets the user has consented(true) or not consented(false) on collect data. In case of not consented, no personal data will be collected and sent to the server.

    Refer here for more info:

    Sample code:

    JSONObject myTarget = new JSONObject();
    try {
        myTarget.put(AdapterConsentKeys.KEY_MYTARGET_USER_AGERESTRICTED, true);
        myTarget.put(AdapterConsentKeys.KEY_MYTARGET_USER_CONSENT, true);
        adapterConsent.put(AdapterConsentKeys.KEY_MYTARGET, myTarget);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    		
  9. UNITY:

    Key Type Inference
    KEY_UNITY_GDPR_CONSENT boolean If the user opts-in to targeted advertising set the key’s value to true else to false.

    Refer here for more info:

    Sample code:

    JSONObject unity = new JSONObject();
    try {
        unity.put(AdapterConsentKeys.KEY_UNITY_GDPR_CONSENT, true);
        adapterConsent.put(AdapterConsentKeys.KEY_UNITY, unity);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    		
  10. VUNGLE:

    Key Type Inference
    KEY_VUNGLE_CONSENT_STATUS String To set the user's consent status to opt in, set the key's value to "OPTED_IN". To set the user's consent status to opted out, set the key's value to "OPTED_OUT".

    Refer here for more info:

    KEY_VUNGLE_CONSENT_MESSAGE_VERSION String It sets the consent message version. This value is an arbitrary string and can be used to identify the version of the consent message presented to the user.

    Sample code:

    JSONObject vungle = new JSONObject();
    try {
        vungle.put(AdapterConsentKeys.KEY_VUNGLE_CONSENT_MESSAGE_VERSION, "1.0.0");
        vungle.put(AdapterConsentKeys.KEY_VUNGLE_CONSENT_STATUS, "OPTED_IN");
        adapterConsent.put(AdapterConsentKeys.KEY_VUNGLE, vungle);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    		

STEP 3: Pass the final JSONObject created using the following API:

		AerServSdk.setAdapterGdprConsent(adapterConsent);
	

exchange | GDPR Consent for Third-party SDKs - iOS

With iOS SDK 904, we have introduced a new API for publishers to pass GDPR consent to various third parties that are part of Aerserv mediation.

+ (void)setAdapterGdprConsent:(NSDictionary *)adapterConsentDictionary;

The consent includes the following partners:

  • ADCOLONY
  • ADMOB
  • APPLOVIN
  • CHARTBOOST
  • FLURRY
  • MILLENNIALMEDIA
  • MOPUB
  • MYTARGET
  • UNITY
  • VUNGLE

Passing the GDPR Consent API

Use the following steps to pass GDPR consent API:

STEP 1: Create a new NSMutableDictionary instance as shown below:

		NSMutableDictionary *consentDict = [NSMutableDictionary new];
	

STEP 2: Add individual consent status for each partner SDK. Refer to the list below for partner-specific list of constants exposed in ASConstants.h. These should be used for passing consent for all listed SDKs.

  1. ADCOLONY:

    Key Type Inference
    AS_KEY_ADCOLONY_GDPR_CONSENT_STRING String Your user's consent string. In this case, the user has given consent to store and process personal information.

    Refer here for more info:

    AS_KEY_ADCOLONY_GDPR_REQUIRED Number Indicates the GDPR requirement of the user. If it is true, then the user is subject to the GDPR laws.

    Sample code:

    [consentDict addEntriesFromDictionary:@{
    	AS_KEY_ADCOLONY : @{
            AS_KEY_ADCOLONY_GDPR_CONSENT_STRING : @"1",
            AS_KEY_ADCOLONY_GDPR_REQUIRED: @1
        }
    }];
    
  2. ADMOB:

    Key Type Inference
    AS_KEY_ADMOB_NON_PERSONALIZED_ADS String The default behaviour of the Google Mobile Ads SDK is to serve personalized ads. If a user has consented to receive only non-personalized ads, you can use the below code to request non personalised regardless of whether or not the user is in the EEA.

    Refer here for more info:

    Sample code:

        [consentDict addEntriesFromDictionary:@{
    	AS_KEY_ADMOB : @{
            AS_KEY_ADMOB_NON_PERSONALIZED_ADS : @"1",
        }
    }];
    
  3. APPLOVIN:

    Key Type Inference
    AS_KEY_APPLOVIN_HAS_USER_CONSENT Number If the user has consented, please set the following key to 1 else 0.

    Refer here for more info:

    AS_KEY_APPLOVIN_IS_AGE_RESTRICITED_USE Number To ensure COPPA, GDPR, and Google Play policy compliance, you should indicate when a user is a child. If the user is known to be in an age-restricted category (i.e., under the age of 16), please set the following key to 1 else 0.

    Sample code:

        [consentDict addEntriesFromDictionary:@{
    	AS_KEY_APPLOVIN : @{
            AS_KEY_APPLOVIN_HAS_USER_CONSENT : @1,
            AS_KEY_APPLOVIN_IS_AGE_RESTRICITED_USER : @0,
        }
    }];
    
  4. CHARTBOOST:

    Key Type Inference
    AS_KEY_CHARTBOOST_PI_DATA_USE_CONSENT Number Set the consent status corresponding to the user's response using the given key.

    Use the number value to represent value of CBPIDataUseConsent enum.

    typedef NS_ENUM(NSInteger, CBPIDataUseConsent)
    {
     /*! Publisher hasn't implemented functionality or the user has the option to not answer. */
     Unknown = -1,
     /*! User does not consent to targeting (Contextual ads). */
     NoBehavioral = 0,
     /*! User consents (Behavioral and Contextual Ads). */
     YesBehavioral = 1
    };
    			

    Refer here for more info:

    Sample code:

        [consentDict addEntriesFromDictionary:@{
        AS_KEY_CHARTBOOST : @{
            AS_KEY_CHARTBOOST_PI_DATA_USE_CONSENT : @1
        }
    }];
    
  5. FLURRY:

    Key Type Inference
    AS_KEY_FLURRY_GDPR_SCOPE Number @1 states that GDPR laws apply, while @0 states that GDPR laws do not apply
    AS_KEY_FLURRY_CONSENT_STRINGS Dictionary Use this dictionary to give the value of Consent Strings.
    NSDictionary*  => .
    NSDictionary *consentDict = [[NSDictionary alloc] initWithObjectsAndKeys:@"iab", @"IAB_Consent_String", nil];
    			

    Refer here for more info:

    Sample code:

        [consentDict addEntriesFromDictionary:@{
        AS_KEY_FLURRY : @{
    	    AS_KEY_FLURRY_GDPR_SCOPE : @1,
    	    AS_KEY_FLURRY_CONSENT_STRINGS: @{@"key":@"value"}
        }
    }];
    
  6. MILENNIALMEDIA:

    Key Type Inference
    AS_KEY_MILLENNIALMEDIA_CONSENT_REQUIRED Number Set to @1 if the user falls under GDPR jurisdiction.
    AS_KEY_MILLENNIALMEDIA_CONSENTDATA_IAB String Sets the IAB Consent String.

    Refer here for more info:

    Sample code:

        [consentDict addEntriesFromDictionary:@{
        AS_KEY_MILLENNIALMEDIA : @{
            AS_KEY_MILLENNIALMEDIA_CONSENT_REQUIRED : @1,
            AS_KEY_MILLENNIALMEDIA_CONSENTDATA_IAB: @"iab_string"
        }
    }];
    
  7. MOPUB:

    Key Type Inference
    AS_KEY_MOPUB_CONSENT Number Set to @1 if the user wants to grant consent or @0 if user wants to revoke consent.

    Refer here for more info:

    Sample code:

        [consentDict addEntriesFromDictionary:@{
        AS_KEY_MOPUB : @{
            AS_KEY_MOPUB_CONSENT : @1,
        }
    }];
    
  8. MYTARGET:

    Key Type Inference
    AS_KEY_MYTARGET_USER_CONSENT Number Set the value to @1 if user has consented to collect data, or @0 to not collect data.

    Refer here for more info:

    AS_KEY_MYTARGET_USER_AGERESTRICTED Number If the user is known to be in an age-restricted category (i.e., under the age of 16), please set this key to @1.

    Sample code:

        [consentDict addEntriesFromDictionary:@{
        AS_KEY_MYTARGET : @{
            AS_KEY_MYTARGET_USER_CONSENT : @1,
            AS_KEY_MYTARGET_USER_AGERESTRICTED: @0
        }
    }];
    
  9. UNITY:

    Key Type Inference
    AS_KEY_UNITY_GDPR_CONSENT Number If the user opts-in to targeted advertising set the value to @1 else @0.

    Refer here for more info:

    Sample code:

        [consentDict addEntriesFromDictionary:@{
        AS_KEY_UNITY : @{
            AS_KEY_UNITY_GDPR_CONSENT : @1,
        }
    }];
    
  10. VUNGLE:

    Key Type Inference
    AS_KEY_VUNGLE_CONSENT_STATUS Number Use this key to set corresponding integer value for VungleConsentStatus enum.
    typedef NS_ENUM (NSInteger, VungleConsentStatus) {
        VungleConsentAccepted = 1,
        VungleConsentDenied,
    };
    			

    Refer here for more info:

    AS_KEY_VUNGLE_CONSENT_MESSAGE_VERSION String It sets the consent message version. This value is an arbitrary string and can be used to identify the version of the consent message presented to the user.

    Sample code:

       [consentDict addEntriesFromDictionary:@{
        AS_KEY_VUNGLE : @{
            AS_KEY_VUNGLE_CONSENT_STATUS : @1,
            AS_KEY_VUNGLE_CONSENT_MESSAGE_VERSION : @"version",
        }
    }];
    

STEP 3: Pass the final consent dictionary created using the following API:

		[AerServSDK setAdapterGdprConsent:consentDict];
	

exchange | GDPR for Third-party SDKs

exchange | Setting up Facebook Audience Network as an ad source

Ad Source Details:

How to Set Up the Facebook Audience Network Ad Source

Step 1: Log on to http://platform.aerserv.com/ and click on the Ad Sources link at the top of the page

Step 2: Click the + or the Add New Ad Source button on thepage

Step 3: Enter a Name for the ad source (example: Facebook Interstitial)

Step 4: Select Facebook as the ad source

Step 5: Enter the following fields that are specific to the Facebook ad source:

FIELD DESCRIPTION REQUIRED/OPTIONAL EXAMPLE
Placement ID Audience Network Placement ID

To see test ads, you may prepend a test ad type to your placement.

Required

839999212758459_841267789298268

Banner Ad Size Select the banner size - leave blank for Interstitial Ads. Required

BANNER_HEIGHT_50

Test Device ID Retrieve the ID from the debug log: When testing your app with Facebook's ad units you must specify the device hashed ID to ensure the delivery of test ads. This ID is available from the debug log. Optional

Step 6: Enter aCPM (example: 3.50)

Step 7: Select a placement(s) for assigning this ad source

Step 8: Select any desired geo or device targeting

Step 9: Click Save

Step 10: Download the AerServ SDK

Locating the Facebook Audience Network Placement ID

  1. Log onto the Facebook Developer account platform and click on Account
  2. Click the My Apps Tab
  3. Click Audience network
  4. Copy the Placement ID
Adding the optional FacebookTestDeviceId

When you run your app on the simulator, test ads will show by default and indicate a successful ad serving call in your app. When testing on a device, however, you must enable test ads by copying the hashed device ID that is printed to the console and set it in code via a dedicated function.

To enable test ads, use the following:

Android:

AerServConfig config = new AerServConfig(this, YOUR_AERSERV_PLACEMENT); 
config.setDebug(true);
  

iOS:

  • Objective C:
    [AerServSDK enableTestMode:YES];
        
  • Swift:
    AerServSDK.enableTestMode(true)
        

You may also see test ads by prepending a test ad type to your Facebook placement. Please consult the Audience Network Guide from Facebook, for more details.

IMPORTANT: Remove this prefix before releasing your application to your end users! For any questions, please reach out to your account manager.

Optional Banner Ad Size

BANNER_HEIGHT_50: (Default) Phone ad size (320x50)

BANNER_HEIGHT_90: Tablet ad size (320x90)

RECTABLE_HEIGHT_250: Medium Rectangle ad size (300x250)

Android

Add the following settings inside your application's build.gradle:

implementation 'com.facebook.android:audience-network-sdk:5.9.1'
  

iOS

Step 1. Add the following frameworks from the folder network-support/Facebook/FBAudienceNetwork.framework to your project frameworks.

  1. FBAudienceNetwork.framework
  2. FBSDKCoreKit.framework

Add the following library to Target > Build Phases > Link Binary With Libraries:

libc++.tbd
  

exchange | Setting up Vungle as an ad source

Ad Source Details:

How to Set Up the Vungle Ad Source

Step 1: Log on to http://platform.aerserv.com/ and click on the Ad Sources link at the top of the page

Step 2: Click the + or the Add New Ad Source button on the page

Step 3: Enter a Name for the ad source (example: Vungle Video)

Step 4: Select Vungle as the ad source

Step 5: Select Video or Interstitial HTML from the Ad Type drop-down menu

Step 6: Enter the following fields that are specific to the Vungle ad source:

Field Description Optional / Required
App ID The unique App ID provided by Vungle that correlates to an App created in the Vungle dashboard. Required
Placement ID The unique Placement ID provided by Vungle that correlates to an placement created in the Vungle dashboard.

Required

Step 7: Enter estimated CPM (example: 3.50)

Step 8: Select desired Placement

Step 9: Select Country or DMA targeting

Step 10: Select Device targeting

Step 11: Click Save

Step 12: Add VungleSDK & Adapter

Locating the Vungle Credentials

Step 1: On the main Pub / Management page, select the Applications (1) tab

Step 2: Click on the Account stage (2) button

Step 3: Select the application desired and click Done

Step 4: You will find your Vungle Application ID (3) under the 'Application details' section

Step 5: On the main Pub / Management page, select the Placements (4) tab

Step 6: You will find your Vungle Placement ID (5) under the 'Reference ID' column in the table

Android

Add the following settings inside your application's build.gradle:

  dependencies { 
  // Vungle SDK
  implementation 'com.vungle:publisher-sdk-android:6.4.11'
  }
  

Add the following configurations inside your AndroidManifest.xml:

<manifest>
    <application>
      <!-- Vungle Activities -->
    <activity
        android:name="com.vungle.warren.ui.VungleActivity"
        android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
        android:launchMode="singleTop"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
    <activity
        android:name="com.vungle.warren.ui.VungleFlexViewActivity"
        android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
        android:launchMode="singleTop"
        android:hardwareAccelerated="true"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity
        android:name="com.vungle.warren.ui.VungleWebViewActivity"
        android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
        android:launchMode="singleTop" />
    </application>
</manifest>
  

Read Vungle's Android documentation for more information.

iOS

Add the Vungle SDK in the folder network-support/Vungle/VungleSDK.framework into your project.

Add the following frameworks to Target > Build Phases > Link Binary With Libraries:

CoreFoundation.framework (Optional)
Foundation.framework (Optional)
StoreKit.framework (Optional)
  

exchange | Setting up AdMob as an ad source

Ad Source Details:

Requirements:

  • InMobi Mediation SDK (iOS|Android)
  • iOS requires updating the *Info.plist with your AdMob app ID.
  • Android requires updating the Android Manifest and gradle.build file.

How to Set Up the AdMob Ad Source

Step 1: Log on to http://platform.aerserv.com/ and click on the Ad Sources link at the top of the page.

Step 2: Click the + or the Add New Ad Source button on thepage.

Step 3: Enter a Name for the ad source (example: AdMob Interstitial).

Step 4: Select AdMob (SDK) as the ad source.

Step 5: Select any one option among Interstitial HTML, Banner HTML, Video, SmartBanner, or Rewarded Video, from the Ad Type drop-down menu.

Step 6: Enter the following fields that are specific to the AdMob ad source:

FIELD DESCRIPTION REQUIRED/OPTIONAL
Ad Unit ID

A unique ID number assigned to each of your ad units when they're created in AdMob. The ad unit ID is added to your apps code and used to identify ad requests from the ad unit.

Required

Step 7: Enter in the appropriate banner size in AdMob Banner Size field, if you have selected Banner HTML as the Ad Type.

Step 8: Enter estimated CPM (e.g.3.50). This value is used as the default CPM, not the floor.

Step 9: Select desired Placement.

Step 10: Select Country or DMA targeting.

Step 11: Select Device targeting.

Step 12: Click Save.

Locating the AdMob Credentials

Step 1: On your AdMob dashboard, click Apps in the sidebar

Step 2: Click the name of the app associated with the ad unit

Note: If you don't see it in the list of recent apps, you can click View All Apps, then click the name of the app

Step 3: Click Ad units in the sidebar

Step 4: Click the icon in the Ad unit ID (1) column, to copy the ID of the ad unit

Android

Add the following settings inside your application's build.gradle:

dependencies {
    implementation 'com.google.android.gms:play-services-ads:18.3.0'
}
	

IMPORTANT: Add your Admob App ID to your app's AndroidManifest.xml file by adding a meta-data tag with name com.google.android.gms.ads.APPLICATION_ID. You can find your App ID in the AdMob UI. For more information, read AdMob documentation.

For example:

<manifest>
    <application>
        <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
    </application>
</manifest>
	

Note: If you are using Android Studio and don't have the following version of play-services, the SDK Manager will prompt you to download the version.

iOS

Step 1. Adding the AdMob SDK to your Project

Option 1: Integrating the framework directly

Add the AdMob SDK in the folder network-support/AdMob/GoogleMobileAds.framework into your project frameworks.

Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:

GoogleMobileAds.framework
GoogleAppMeasurement.framework
GoogleUtilities.framework
nanopb.framework
	

Option 2: Integration via Cocoapods

Open your project's Podfile and add this line to your app's target:

pod 'Google-Mobile-Ads-SDK', '~> 7.52'

Step 2. Add the following entry into your info.plist:

<dict>
     <key>NSAllowsArbitraryLoadsForMedia</key>
     <true/>
     <key>NSAllowsArbitraryLoadsInWebContent</key>
     <true/>
</dict>
	

IMPORTANT: In your app's info.plist file, add a GADApplicationIdentifier key with a string value of your AdMob app ID. You can find your App ID in the AdMob UI. For more information, read AdMob documentation.

For example:

<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
	

exchange | Monetization (Server to Server)

Introduction

The InMobi Server to Server Ad Request API spec allows publishers to integrate with InMobi directly from their server. This document lays out the Ad request, response structures and the parameters included in each of them to enable publishers to integrate with InMobi.

API Versioning & End Point

The new version of the API spec is designated version 3.1. Consequently, the Ad Request URL must reflect the version. It then becomes:

HTTP End Point: http://api.w.inmobi.com/showad/v3.1
HTTPS End Point: https://api.w.inmobi.com/showad/v3.1

Request Method

Ad requests must be sent using the HTTP Post method. All request parameters must be sent within a JSON object within the POST body.

Integrating with the API

HTTP Headers

InMobi expects all HTTP headers including x-headers to be sent as a part of the request. For all forwarded headers (x-headers), InMobi expects the original values received from the user’s device.

Header Name

Type

Description

Values

Content-Type

Mandatory/Optional

The MIME type of the body of the request.

application/json

Request Object

The top-level ad request object contains the entire JSON payload with the request. This object is expected to contain, at a minimum, the following:

  • The imp object defining the request ad impressions properties
  • The site or app object containing the unique placement ID
  • The device object containing the client IP address and user agent information

The child objects and parameters under the Request object are described in the following table:

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

imp

object

request

Mandatory

Impression object. Contains details about the ad request.

site

object

request

Mandatory

Details about the publisher’s mobile website. Only applicable for mobile websites.

app

object

request

Mandatory

Details about the publisher’s mobile app. Only applicable for mobile apps.

device

object

request

Mandatory

Details about the user’s device to which the impression will be delivered.

user

object

request

Recommended

Details about the user of the device; the advertising audience.

ext

object

request

Mandatory

Extensions to the request object for sending publisher specific data.

responseformat

string

request.ext

Mandatory

json - For all ads

pchain

string

request.ext

Recommended

Payment id details for TAG compliance.

Impression (imp) Object

The imp object defines the type and number of ad impressions desired by the publisher. This is a mandatory object in the ad request and must contain one or more of the parameters dsiescribed in the table below.

iOS 9 and App Transport Security (ATS)

To receive secure ads on devices running iOS 9 and later, add the secure parameter to the impression request. This is especially important if you need secure responses. If this parameter is not present, InMobi will interpret it as a request for an unsecured ad.

For details on the other changes in iOS 9, please read our blog.

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

banner

object

imp

Recommended

A Banner object; required if this impression is offered as a banner or interstitial ad opportunity.

native

object

imp

Recommended

A Native object; required if a native ad response is desired.

displaymanager

string

imp

Recommended

Name of ad mediation partner, SDK technology or player responsible for rendering the Ad (typically mobile).

displaymanagerver

string

imp

Recommended

Version of ad mediation partner, SDK technology or player responsible for rendering the Ad (typically mobile).

secure

integer

imp

Recommended

Flag to indicate if the impression requires secure HTTPS URL creative assets and markup, where 0 = non-secure, 1 = secure.

If omitted, non-secure HTTP response is assumed.

ext

object

imp

Recommended

Extensions to the impression object.

ads

integer

imp.ext

Recommended

Number of ads in the response. The maximum allowed value is 10 but the recommended value is 1.

trackertype

string

imp

Recommended

“url_ping”, indicates NoJS ad,
Native Ads
“webview”, indicates JS ad. Rest of the adformats

pmp

object

request

Mandatory for PDB deal

Details about PMP deal

For Banner Integration - Banner (imp.banner) Object

The Banner object is used to request for a banner ad. This object is used to specify the banner impression type required. This is a Recommended field and must not be sent if the native object is part of the request.

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

w

integer

banner

Mandatory

Width of the impression in pixels.

h

integer

banner

Mandatory

Height of the impression in pixels.

api

integer array

banner

Recommended

1 if MRAID 1.0 is supported

2 if MRAID 2.0 is supported

ext

object

banner

Recommended

Extension object within the banner object to transmit parameters which are outside the spec

For Interstitial Integration - Banner (imp.banner) Object

The Banner object is used to request for an interstitial ad. This object is used to specify the banner impression type required. This is a Recommended field and must not be sent if the native object is part of the request. Please ensure that you use a separate placement id for interstitial integration in case you are integrating both banner and interstitial in your app.

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

w

integer

banner

Mandatory

Width of the impression in pixels.

h

integer

banner

Mandatory

Height of the impression in pixels.

api

integer array

banner

Recommended

1 if MRAID 1.0 is supported

2 if MRAID 2.0 is supported

ext

object

banner

Recommended

Extension object within the banner object to transmit parameters which are outside the spec

For Native Integration - Native (imp.native) Object

The Native object is used to request for a Native ad. This object is used to indicate native ad specification of the response structure required. This is a Recommended field and must not be sent if the banner object is part of the request.

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

layout

integer

native

Recommended

The Layout ID of the native ad unit. This field must be one of the following:

1 Paid Search Units

2 Recommendation Widgets

3 Promoted Listings

4 In-Ad (IAB Standard) with Native Element Units

5 Custom

ext

object

native

Recommended

Extension object within the native object to transmit parameters which are outside the spec.

screenWidth

integer

ext

Conditional Mandatory

Native object is also used for requesting inline banner ads. When request is made for inline banner ads (with placement id for inline banner), screenWidth field should be mandatory, set to slot width.

Site Object

This object should be included if the publisher’s property is a mobile website and not a mobile app. A request must not contain both a Site and an App object.

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

id

string

site

Mandatory

InMobi Placement ID for the ad placement under the given property

name

string

site

Recommended

Site name

domain

string

site

Recommended

Domain of the site

page

string

site

Recommended

URL of the page where the ad will be shown

ref

string

site

Recommended

Referrer URL that caused navigation to the current page.

cat

string array

site

Recommended

Array of IAB content categories of the app.

Please refer to the Appendix for a full list of allowed categories.

keywords

string

site

Recommended

Comma separated list of keywords about the site.

ext

object

site

Recommended

Extension object within the site object to transmit parameters which are outside the spec

reftag

string

site.ext

Recommended

Reference Tag for the ad request. The value of this parameter should be a string by which Reporting/Performance Metrics groupings are needed by the publisher.

For example, reftag=login can be used to group Reporting / Performance metrics based on advertisements served on a login page, only.

Notes:

  • Reftag parent object is site. Please pass the reftag in the following way:
    Example
    "site":
    {"id":
    "caeb5f745b85499da8c09bcb4c571206","reftag":" watchopnow.com"
    }
  • If you are sending app traffic through reftag, then pass the bundle ID (playstore or itunes) of the app via reftag. (We will update you actionable points on non-playstore and non-iOS apps shortly).reftag=”<package name> "
  • Example:

    • iOS, reftag=”com.test.inmobi”
    • Android, reftag= “com.test.inmobi”

App Object

This object should be included if the publisher’s property is a mobile app and not a mobile website. A request must not contain both a Site and an App object.

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

id

string

app

Mandatory

InMobi Placement ID for the ad placement under the given property.

name

string

app

Recommended

App name

bundle

string

app

Recommended

Application bundle or package name as provided in the Apple App Store or Google Play Store.

domain

string

app

Recommended

Domain of the app.

storeurl

string

app

Recommended

App store URL for an installed app.

cat

string array

app

Recommended

Array of IAB content categories of the app.

Please refer to the Appendix for a full list of allowed categories.

ver

string

app

Recommended

Application version.

paid

integer

app

Recommended

Indicates if it is a free or a paid app. The value must be one of:

0 if the app is free

1 if the app is a paid app

keywords

string

app

Recommended

Comma separated list of keywords about the app.

ext

object

app

Optional

Extension object within the app object to transmit parameters which are outside the spec

reftag

string

app.ext

Optional

Reference Tag for the ad request. The value of this parameter should be a string by which Reporting/Performance Metrics groupings are needed by the publisher.

For example, reftag=login can be used to group Reporting / Performance metrics based on advertisements served on a login page, only

Device Object

This object provides information pertaining to the device through which the user is interacting. Device information includes its hardware, platform, location, and carrier data. This is a mandatory object in the request and must contain all mandatory parameters listed in the following table.

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

ua

string

device

Mandatory

User Agent of the device. This must be the original user agent without any modifications.

geo

object

device

Recommended

Location of the device assumed to be the user’s current location defined by a Geo object.

lmt

integer

device

Mandatory with IDFA or GPID

Limit Ad Tracking setting of the device. The value should be:

Android:

1 If the user has turned ON “Opt out of interests-based ads”

0 If the user has turned OFF “Opt out of interests-based ads”

iOS:

1 If the user has turned ON “Limit Ad Tracking” switch on the device

0 If the user has turned OFF “Limit Ad Tracking” switch on the device

If absent, a value of 0 is assumed.

ip

string

device

Mandatory

IP Address of the device in IPv4 format. Required if the ipv6 field is absent.

make

string

device

Recommended

Device Make.

model

string

device

Recommended

Model name of the device.

os

string

device

Recommended

Name of the Operating System currently installed on the device.

osv

string

device

Recommended

Version of the Operating System currently installed on the device.

hwv

string

device

Recommended

Hardware version of the device.

h

integer

device

Recommended

Height of the device screen in pixels.

w

integer

device

Recommended

Width of the device screen in pixels.

ppi

integer

device

Recommended

Pixels per inch of the device screen.

pxratio

float

device

Recommended

The ratio of physical pixels to device independent pixels.

language

string

device

Recommended

Browser language using ISO-639-1-alpha-2.

carrier

string

device

Recommended

Name of the carrier to which the device is currently connected.

connectiontype

integer

device

Recommended

1 if Ethernet

2 if WIFI

3 if CELLULAR UNKNOWN

4 if 2G

5 if 3G

6 if 4G

ifa

string

device

Conditionally mandatory

Identifiers for Advertisers on the iOS platform. Mandatory if the app object is present in the request. If app object is present but request does not contain ifa (for iOS only) the request will be invalidated.

idv

string

device

Recommended

Identifier for vendors (on iOS).

gpid

String

device

Conditionally mandatory

Google Advertising ID on Android (Where available). Mandatory if the app object is present in the request. If app object is present but request does not contain GPID OR O1 (for Android only) the request must be invalidated.

o1

String

device

Conditionally mandatory

ODIN1 value for the device. This is an alternative to GPID. O1 is the SHA1 hashed value of the Android_ID of the device.

iuds1

String

device

Recommended

UDID of the device hashed using SHA1 (SHA1 checksum of UDID). Only applicable for devices below iOS 6.

um5

String

device

Recommended

Android: MD5 of Android_ID

iOS: UDID of the device hashed using MD5 (MD5 checksum of UDID). Only applicable for devices below iOS 6.

ext

object

device

Optional

Extension object within the device object to transmit parameters which are outside the spec.

orientation

integer

device.ext

Recommended

Device orientation used for serving ads with the most optimal orientation and user experience. The value to be sent based on the orientation of the device are as follows:

1 for portrait

2 for reverse portrait

3 for landscape

4 for reverse landscape

wc

String

device.ext

Recommended

Web cookie. For Mobile Web only.

sid

String

device.ext

Recommended

For Mobile Web only.

lid

String

device.ext

Recommended

For Mobile Web only.

locale

String

device.ext

Recommended

Indicates the Locale preference set on the device.

Note: Ensure that the orientation parameter in the ad request is dynamically passed based on the actual orientation of the user’s device. This is to ensure that orientation of the ad displayed on your site matches the orientation of the user’s device.

Geo (device.geo) Object

This object encapsulates various methods for specifying a geographic location of the device. This information is highly recommended as geo-enriched requests typically result in higher value ads. InMobi recommends sending fresh values for the user’s location to ensure the most locally relevant ads are served.

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

lat

float

geo

Recommended

Latitude of the device based on the GPS location.

lon

float

geo

Recommended

Longitude of the device based on the GPS location.

accu

float

geo

Recommended

Accuracy of the latitude and longitude of the device as indicated by the device GPS.

type

Integer

geo

Recommended

The type field will indicate if the lat, lon fields populated in the request is the actual lat lon or lat-lon derived from the IP address by the publisher.

1 if GPS/Location Services

2 if IP Address

city

String

geo

Recommended

City of the user.

country

String

geo

Recommended

Country code using ISO-3166-1-alpha-3.

zip

String

geo

Recommended

Zip code of the user.

ext

object

geo

Optional

Extension object within the geo object to transmit parameters which are outside the spec.

ts

long

geo.ext

Recommended

Timestamp of the location query from the device in milliseconds.

cbssid

string

geo.ext

Recommended

Mac Address of the Connected WiFi access point.

cct

object

geo.ext

Recommended

Connected cell tower information

vct

object array

geo.ext

Recommended

Visible cell towers information.

User Object

This object contains information (User Demographics) known or derived about the human user of the device (that is the audience for advertising). This information allows finer targeting resulting in better monetization for publishers.

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

yob

integer

user

Recommended

Year of birth of the user.

gender

string

user

Recommended

The user’s gender:

Must be one of

m for Male

f for Female

keywords

string

user

Recommended

Comma separated list of keywords, interests, or intent.

ext

object

user

Recommended

Extension object within the user object to transmit parameters which are outside the spec.

education

String

user.ext

Recommended

Education level of the user.

Possible values: highschoolorless, collegeorgraduate, postgraduateorabove

language

String

user.ext

Recommended

Content language using ISO-639-1-alpha-2.

interests

String

user.ext

Recommended

Comma separated list of user’s interests.

age

Integer

user.ext

Recommended

Age of the user in years. This must be a non-negative, non-zero value.

consent

String

user.ext

Recommended

User consent when GDPR regulations are in effect.

Deviation from the following set of values indicates an unknown entity:

0/false = No and 1/true = Yes, iab consent string

Regs Object

This object contains any legal, governmental, or industry regulations that apply to the request. The coppa flag signals whether or not the request falls under the United States Federal Trade Commission’s regulations for the United States Children’s Online Privacy Protection Act (“COPPA”).

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

coppa

integer

regs

Recommended

Flag indicating if this request is subject to the COPPA regulations established by the USA FTC, where 0 = no, 1 = yes.

ext

object

regs

Optional

Extension object within the regs object to transmit parameters which are outside the spec.

gdpr

string

regs.ext

Optional

Confirmation if the request is subject to GDPR regulations.

Deviation from the following set of values, 0 = No and 1 = Yes, indicates an unknown entity.

Private Marketplace (imp.pmp) Object

The pmp object has been specifically defined for Programmatic Direct Buying (PDB) deals. The object is expected to contain at a minimum, the following details:

  • Private auction object defining the auction type
  • Deal object containing the deal id in it

Sample:

"pmp" : {
			"private_auction" : 1,
			"deals" : [{"id":"dummyid"}
			]
	     },
		

Object / Parameter

Type

Parent Object

Mandatory/Recommended

Description

private_auction

integer

pmp

Mandatory for PDB deal

The value should be 1 to indicate it is a private auction

deal

list

pmp

Mandatory for PDB deal

Contain the deal details (id/auctiontype/bidlfoor)

Deal (deal) Object [Parent: pmp]

The deal object under pmp is used to define the deal id, auction deal type and the bid floor.

Object / Parameter

Type

Parent Object

Mandatory / Recommended

Description

id

string

deal

Mandatory for PDB deal

Contain the deal ID

at

integer

deal

Recommended for PDB deal

Auction Type as per opec rtb spec

bidfloor

float

deal

Recommended for PDB deal

Ad Request Response Samples

Sample Ad Requests

This section provides sample Ad requests for the different Ad Experiences supported by InMobi. The POST body structure provided below can be viewed when the ad request is captured using a network packet capture tool like Charles, or Wireshark, for example.

Interstitial Ads

{
"app":{
"id":"<Placement ID>", //Please replace the value with the placement id value
"bundle":"com.midasplayer.apps.candycrushsaga",
"name":"candy crush",
"domain":"king.com",
"storeurl":"https://itunes.apple.com/in/app/candy-crush-saga/id553834731?mt=8",
"cat":[
"Humor",
"Gaming"
],
"ver":"2.0",
"paid":0,
"keywords":"game, casual",
"ext": {
"reftag":"login"
}
},
"imp":{
"banner":{
"w":320,
"h":480,
"api":[
1,
2
]
},
"secure":0,
"ext": {
"ads":1
},
"displaymanager":"mopub",
"displaymanagerver":"2.0"
},
"device":{
"ifa":"FC0F3445-0FCE-40EE-8646-3CA8BB2663EA",
"ua":"Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12D436 Safari/600.1.4",
"ip":"3.0.119.0",
"lmt":0,
"make":"Apple inc",
"model":"iphone 6",
"os":"iOS",
"osv":"8.0",
"hwv":"2.0",
"language":"en",
"carrier":"AT&T",
"connectiontype":2,
"geo":{
"lat":40.7127,
"lon":74.0059,
"accu":1.0,
"type":2
}
},
"ext":{
"responseformat":"json"
},
"user":{
    "yob":1990,
    "gender":"m",
    "keywords":"gamer",
    "ext":{
        "education":"collegeorgraduate",
        "language":"en",
        "interests":"gaming",
        "age":25,
        "consent": 0
    }
},
"regs":{
     "coppa":0,
      "ext": {
            "gdpr": 0
      }
}
		

Banner Ads

{
    "app":{
        "id":"<Placement ID>", //Please replace the value with the placement id value
        "bundle":"com.midasplayer.apps.candycrushsaga",
        "name":"candy crush",
        "domain":"gaming",
        "storeurl":"https://itunes.apple.com/in/app/candy-crush-saga/id553834731?mt=8",
        "cat":[
            "Humor",
            "Gaming"
        ],
        "ver":"2.0",
        "paid":0,
        "keywords":"casual, game",
	  "ext": {
       "reftag":"login"
  }
    },
    "imp":{
        "banner":{
            "w":320,
            "h":48,
            "api":[
                1,
                2
            ]
        },
        "secure":0,
	  "ext": {
       "ads":1
  },
        "displaymanager":"mopub",
        "displaymanagerver":"2.0"
    },
    "device":{
        "ifa":"FC0F3445-0FCE-40EE-8646-3CA8BB2663EA",
        "ua":"Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12D436 Safari/600.1.4",
        "ip":"3.0.119.0",
        "lmt":0,
        "make":"Apple inc",
        "model":"iphone 6",
        "os":"iOS",
        "osv":"8.0",
        "hwv":"2.0",
        "language":"en",
        "carrier":"AT&T",
        "connectiontype":2,
        "geo":{
            "lat":40.7127,
            "lon":74.0059,
            "accu":1.0,
            "type":2
        }
    },
    "ext":{
        "responseformat":"json"
    },
"user":{
    "yob":1990,
    "gender":"m",
    "keywords":"gamer",
    "ext":{
        "education":"collegeorgraduate",
        "language":"en",
        "interests":"gaming",
        "age":25,
        "consent": 0
    }
},
"regs":{
     "coppa":0,
      "ext": {
            "gdpr": 0
      }
}
		

Native Ads

{
"app":{
"id":"<Placement ID>", //Please replace the value with the placement id value
"bundle":"com.midasplayer.apps.candycrushsaga",
"name":"candy crush",
"domain":"king.com",
"storeurl":"https://itunes.apple.com/in/app/candy-crush-saga/id553834731?mt=8",
"cat":[
"Humor",
"Gaming"
],
"ver":"2.0",
"paid":0,
"keywords":"casual,game",
"ext": {
"reftag":"login"
}
},
"imp":{
"native":{
"layout":2
},
"secure":0,
"trackertype":"url_ping",
"ext": {
"ads":1
},
"displaymanager":"mopub",
"displaymanagerver":"2.0"
},
"device":{
"ifa":"FC0F3445-0FCE-40EE-8646-3CA8BB2663EA",
"ua":"Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12D436 Safari/600.1.4",
"ip":"3.0.119.0",
"lmt":0,
"make":"Apple inc",
"model":"iphone 6",
"os":"iOS",
"osv":"8.0",
"hwv":"2.0",
"language":"en",
"carrier":"AT&T",
"connectiontype":2,
"geo":{
"lat":40.7127,
"lon":74.0059,
"accu":1.0,
"type":2
}
},
"ext":{
"responseformat":"json"
},
"user":{
    "yob":1990,
    "gender":"m",
    "keywords":"gamer",
    "ext":{
        "education":"collegeorgraduate",
        "language":"en",
        "interests":"gaming",
        "age":25,
        "consent": 0
    }
},
"regs":{
     "coppa":0,
      "ext": {
            "gdpr": 0
      }
}
		

Native Example:

curl api.w.inmobi.com/showad/v3 -d 
'{"app":{"id":"1452884093377","bundle":"com.midasplayer.apps.candycrushsaga"},"imp":{"native":{"layout":2}, 
"secure":0,
"trackertype":"url_ping"},"device":{"ifa":"FC0F3445-0FCE-40EE-8646-3CA8BB2663EA","ua":"Mozilla/5.0
(iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0
Mobile/12D436 Safari/600.1.4","ip":"3.0.119.0"},"ext":{"responseformat":"json"}}' -H 'Content-Type: 
application/json'
		

Note: Site, device, and user information should be dynamically passed based on the user’s device and never hardcoded.

Ad Response Templates

The InMobi Ad Server responses are delivered as a UTF-8 encoded payload with JSON format. The JSON object is Base64 encoded for error free transmission and must be decoded prior to rendering the ad.

The InMobi JSON responses follow the structure shown here:

  • The root element is ads array object containing one or more ads.
  • For non-native ads, each ad element contains the pubContent object which is a render-ready HTML snippet. This HTML must be executed as is and must not be parsed. Typically, the HTML snippet is expected to be injected within a webview to display the ad.
  • For native ads, the pubContent contains a list of assets as defined by the publisher in the InMobi CI. To display a native ad, please see the Integrating Native Ads section of this guide.

JSON Response Templates

This section shows templates of JSON responses. For Banner and Interstitial ads, you must extract the value of the pubContent object and render the same in a webview. For Native ads, please see the Integrating Native Ads section of this guide.

Fill Responses

Banner Ads

{
"ads":[
{
"pubContent":"plain text"
"adtype": " ",
"width": ,
"height": ,
"lp": ,
},
{
"pubContent": "plain text"
"adtype": " ",
"width": ,
"height": ,
"lp": , 
}
.
.
.
],
"requestId":""
}
		

Sample Response:

 { "ads": [  {"pubContent":"<div style=\"display:none; position:absolute;\" id=\"im_6640_clickTarget\"></div> <script type=\"text/javascript\"> (function() {var e=window,f=encodeURIComponent,h=document,k='appendChild',l='setAttribute',p='createElement',q='',r='&',s='0',t='2',u='=',v='?m=',w='Events',x='_blank',y='a',z='click',A='clickCallback',B='clickTarget',C='error',D='event',E='function',F='height',G='href',H='iatSendClick',I='iframe',J='img',K='impressionCallback',L='onclick',M='openLandingPage',N='recordEvent',O='seamless',P='src',Q='target',R='width';e.inmobi=e.inmobi||{};var S=e.inmobi;S.d=S.d||[]; S.c=function(a,b){for(var c=S.d,d=0;d<c.length;d++)c[d].call(this,a,b)};S.recordEvent=S.c; function T(a){function b(a,b){c.c(a,b)}this.j=a.lp;this.k=a.lps;this.b=a.ct;this.f=a.tc;this.h=a.bcu;this.a=a.ns;this.l=a.ws;this.g=a.sc;a=this.a;var c=this;e[a+M]=function(){var a=T.e(c.j),b=e.mraid;'undefined'!==typeof b&&'undefined'!==typeof b.openExternal?b.openExternal(a):(a=T.e(c.k),b=h[p](y),b[l](Q,x),b[l](G,a),h.body[k](b),T.i(b))};e[a+A]=function(a){U(c,a)};e[a+K]=function(){V(c)};e[a+N]=b;this.g&&S.d.push(b)}S.Bolt=T; T.i=function(a){if(typeof a.click==E)a.click.call(a);else if(a.fireEvent)a.fireEvent(L);else if(a.dispatchEvent){var b=h.createEvent(w);b.initEvent(z,!1,!0);a.dispatchEvent(b)}};T.e=function(a){return a.replace(/\\$TS/g,q+(new Date).getTime())};function W(a,b){var c=h.getElementById(a.a+B),d=h[p](I);d[l](P,b);d[l](O,O);d[l](F,s);d[l](R,t);c[k](d)} function U(a,b){var c=e[a.a+H];c&&c();if(null!=a.b)for(var c=a.b.length,d=0;d<c;d++)W(a,T.e(a.b[d]));a.l&&(b=b||eval(D),'undefined'!==typeof b&&(c=void 0!=b.touches?b.touches[0]:b,e.external.notify(JSON.stringify({m:c.clientX,n:c.clientY}))))}function V(a){if(null!=a.f)try{var b=h.getElementById(a.a+B),c=a.f,d=h[p](I);d[l](O,O);d[l](F,s);d[l](R,t);b[k](d);var g=d.contentWindow;g&&g.document.write(c)}catch(n){}} T.prototype.c=function(a,b){function c(a,b,g){if(!(0>=g)){var n=h.getElementById(d.a+B),m=h[p](J);m[l](P,a);m[l](F,s);m[l](R,t);void 0!=m.addEventListener&&m.addEventListener(C,function(){e.setTimeout(function(){3E5<b&&(b=3E5);c(a,2*b,g-1)},b*Math.random())},!1);n[k](m)}}var d=this,g=this.h,g=g+(v+a);if(b)for(var n in b)g+=r+f(n)+u+f(b[n]);c(g,1E3,5);18==a&&V(this);8==a&&U(this,null)};})(); (function() {var a=window,c='handleClick',e='handleTouchEnd',f='handleTouchStart';a.inmobi=a.inmobi||{};function g(b,h){this.b=h;this.a=this.c=!1;var d=this;a[b+c]=function(){d.click()};a[b+f]=function(){d.start(a.event)};a[b+e]=function(){d.end()}}a.inmobi.OldTap=g;g.prototype.click=function(){this.c||this.b()};g.prototype.start=function(b){this.a=this.c=!0;b&&b.preventDefault()};g.prototype.end=function(){this.a&&(this.a=!1,this.b())};})(); new window.inmobi.Bolt({\"lp\":\"https://itunes.apple.com/app/uber/id368677368?mt\\u003d8\\u0026ct\\u003dInMobi\",\"lps\":\"https://itunes.apple.com/app/uber/id368677368?mt\\u003d8\\u0026ct\\u003dInMobi\",\"ct\":[\"https://c.w.inmobi.com/c.asm/C/t/eanpprow7z/1blu/r/2m/ba/u/0/0/0/eyJVSUQiOiJGQzBGMzQ0NS0wRkNFLTQwRUUtODY0Ni0zQ0E4QkIyNjYzRUEiLCJJREEiOiJGQzBGMzQ0NS0wRkNFLTQwRUUtODY0Ni0zQ0E4QkIyNjYzRUEifQ~~/109dfe8a-0155-1000-dc5f-411d5fa80095/-1/0/-1/1/0/x/12887719/NW/2t/0/api/3.1.0/dir/Y29tLm1pZGFzcGxheWVyLmFwcHMuY2FuZHljcnVzaHNhZ2E~/FsjxCRaA9bIMFv6Dh9S7VDco1z72RURlPxQeFwAAAAAAAPA_FwAAAAAAAAAAF2Gr45wqvLQ_FAISGDg1TE11NER6NDQybFlLeVlJek1YdWQwbjJlRm5URTFnSDNnWFpDOXNLeDZkL20zZDB3SCtzeFE9PRgGQkFOTkVSHBQAFAIcHBaAwKiVwKL_nSEW1cX_vvS437dGABakzo3irMX72lkVABIAADkFIRQAForC4OnbUSgQd2ViMTA0MS5hZHMuaGtnMRQEEjwVAgAsFQIAAA/-1/AA/6/17f5e44d?at\\u003d1\\u0026am\\u003d0\"],\"bcu\":\"https://et.w.inmobi.com/c.asm/C/t/eanpprow7z/1blu/r/2m/ba/u/0/0/0/eyJVSUQiOiJGQzBGMzQ0NS0wRkNFLTQwRUUtODY0Ni0zQ0E4QkIyNjYzRUEiLCJJREEiOiJGQzBGMzQ0NS0wRkNFLTQwRUUtODY0Ni0zQ0E4QkIyNjYzRUEifQ~~/109dfe8a-0155-1000-dc5f-411d5fa80095/-1/0/-1/0/0/x/12887719/NW/2t/0/api/3.1.0/dir/Y29tLm1pZGFzcGxheWVyLmFwcHMuY2FuZHljcnVzaHNhZ2E~/FsjxCRaA9bIMFv6Dh9S7VDco1z72RURlPxQeFwAAAAAAAPA_FwAAAAAAAAAAF2Gr45wqvLQ_FAISGDg1TE11NER6NDQybFlLeVlJek1YdWQwbjJlRm5URTFnSDNnWFpDOXNLeDZkL20zZDB3SCtzeFE9PRgGQkFOTkVSHBQAFAIcHBaAwKiVwKL_nSEW1cX_vvS437dGABakzo3irMX72lkVABIAADkFIRQAForC4OnbUSgQd2ViMTA0MS5hZHMuaGtnMRQEEjwVAgAsFQIAAA/-1/AA/6/76cf6033\",\"ws\":false,\"ns\":\"im_6640_\",\"sc\":true}); new window.inmobi.OldTap(\"im_6640_\", function() { window['im_6640_openLandingPage'](); window['im_6640_recordEvent'](8); }); </script> <style> .inmC { margin-left: auto; margin-right: auto; display: block; }</style> <div onclick=\"im_6640_handleClick()\" ontouchstart=\"im_6640_handleTouchStart()\" ontouchend=\"im_6640_handleTouchEnd()\"> <img border=\"0\" class=\"inmC\" src=\"https://i.l.inmobicdn.net/banners/FileData/6649fab2-df07-45c8-be3a-29c3505c953d.jpeg\" alt=\"Uber\" height=\"48\" width=\"307\" /> </div> <style>body{margin:0}</style> <script type=\"text/javascript\"> im_6640_recordEvent(18); </script>","adtype":"rm","width":320,"height":48,"lp":"https://c.w.inmobi.com/c.asm/C/t/eanpprow7z/1blu/r/2m/ba/u/0/0/0/eyJVSUQiOiJGQzBGMzQ0NS0wRkNFLTQwRUUtODY0Ni0zQ0E4QkIyNjYzRUEiLCJJREEiOiJGQzBGMzQ0NS0wRkNFLTQwRUUtODY0Ni0zQ0E4QkIyNjYzRUEifQ~~/109dfe8a-0155-1000-dc5f-411d5fa80095/-1/0/-1/1/0/x/12887719/NW/2t/0/api/3.1.0/dir/Y29tLm1pZGFzcGxheWVyLmFwcHMuY2FuZHljcnVzaHNhZ2E~/FsjxCRaA9bIMFv6Dh9S7VDco1z72RURlPxQeFwAAAAAAAPA_FwAAAAAAAAAAF2Gr45wqvLQ_FAISGDg1TE11NER6NDQybFlLeVlJek1YdWQwbjJlRm5URTFnSDNnWFpDOXNLeDZkL20zZDB3SCtzeFE9PRgGQkFOTkVSHBQAFAIcHBaAwKiVwKL_nSEW1cX_vvS437dGABakzo3irMX72lkVABIAADkFIRQAForC4OnbUSgQd2ViMTA0MS5hZHMuaGtnMRQEEjwVAgAsFQIAAA/-1/AA/6/17f5e44d"}   ],"requestId" : "109dfe5e-0155-1000-c800-3e9000000090" }
		
Native Ads
{
   "ads":[
       {
           "pubContent":"json string of ad resources",
 	     "contextCode":"",
	     "namespace":"",
       },
       {
           "pubContent":"json string of ad resources",
           "contextCode":"",
	     "namespace":"",
       },
	  .
	  .
	  .
   ],
   "requestId":""
}
		

Sample Response:

 { "ads": [  {"pubContent":{"title":"Uber","description":"Get a reliable ride in minutes with the Uber app���no reservations or waiting in taxi lines. From lo","icon":{"width":300.0,"height":300.0,"url":"http://i.l.inmobicdn.net/uac-assets/368677368-us-1455192789646","aspectRatio":1.0},"screenshots":{"width":320.0,"height":480.0,"url":"http://i.l.inmobicdn.net/banners/FileData/cef51cdf-103b-4a61-81bf-7b34d81322a7.jpeg","aspectRatio":0.66},"landingURL":"https://itunes.apple.com/app/uber/id368677368?mt=8&ct=InMobi","cta":"install","rating":4.0},"contextCode":"<div style=\"display:none; position:absolute;\" id=\"im_4194_clickTarget\"></div>\n<script type=\"text/javascript\">\n 	(function() {var e=window,f=encodeURIComponent,h=document,k='appendChild',l='setAttribute',p='createElement',q='',r='&',s='0',t='2',u='=',v='?m=',w='Events',x='_blank',y='a',z='click',A='clickCallback',B='clickTarget',C='error',D='event',E='function',F='height',G='href',H='iatSendClick',I='iframe',J='img',K='impressionCallback',L='onclick',M='openLandingPage',N='recordEvent',O='seamless',P='src',Q='target',R='width';e.inmobi=e.inmobi||{};var S=e.inmobi;S.d=S.d||[];\nS.c=function(a,b){for(var c=S.d,d=0;d<c.length;d++)c[d].call(this,a,b)};S.recordEvent=S.c;\nfunction T(a){function b(a,b){c.c(a,b)}this.j=a.lp;this.k=a.lps;this.b=a.ct;this.f=a.tc;this.h=a.bcu;this.a=a.ns;this.l=a.ws;this.g=a.sc;a=this.a;var c=this;e[a+M]=function(){var a=T.e(c.j),b=e.mraid;'undefined'!==typeof b&&'undefined'!==typeof b.openExternal?b.openExternal(a):(a=T.e(c.k),b=h[p](y),b[l](Q,x),b[l](G,a),h.body[k](b),T.i(b))};e[a+A]=function(a){U(c,a)};e[a+K]=function(){V(c)};e[a+N]=b;this.g&&S.d.push(b)}S.Bolt=T;\nT.i=function(a){if(typeof a.click==E)a.click.call(a);else if(a.fireEvent)a.fireEvent(L);else if(a.dispatchEvent){var b=h.createEvent(w);b.initEvent(z,!1,!0);a.dispatchEvent(b)}};T.e=function(a){return a.replace(/\\$TS/g,q+(new Date).getTime())};function W(a,b){var c=h.getElementById(a.a+B),d=h[p](I);d[l](P,b);d[l](O,O);d[l](F,s);d[l](R,t);c[k](d)}\nfunction U(a,b){var c=e[a.a+H];c&&c();if(null!=a.b)for(var c=a.b.length,d=0;d<c;d++)W(a,T.e(a.b[d]));a.l&&(b=b||eval(D),'undefined'!==typeof b&&(c=void 0!=b.touches?b.touches[0]:b,e.external.notify(JSON.stringify({m:c.clientX,n:c.clientY}))))}function V(a){if(null!=a.f)try{var b=h.getElementById(a.a+B),c=a.f,d=h[p](I);d[l](O,O);d[l](F,s);d[l](R,t);b[k](d);var g=d.contentWindow;g&&g.document.write(c)}catch(n){}}\nT.prototype.c=function(a,b){function c(a,b,g){if(!(0>=g)){var n=h.getElementById(d.a+B),m=h[p](J);m[l](P,a);m[l](F,s);m[l](R,t);void 0!=m.addEventListener&&m.addEventListener(C,function(){e.setTimeout(function(){3E5<b&&(b=3E5);c(a,2*b,g-1)},b*Math.random())},!1);n[k](m)}}var d=this,g=this.h,g=g+(v+a);if(b)for(var n in b)g+=r+f(n)+u+f(b[n]);c(g,1E3,5);18==a&&V(this);8==a&&U(this,null)};})();\n (function() {var a=window,c='handleClick',e='handleTouchEnd',f='handleTouchStart';a.inmobi=a.inmobi||{};function g(b,h){this.b=h;this.a=this.c=!1;var d=this;a[b+c]=function(){d.click()};a[b+f]=function(){d.start(a.event)};a[b+e]=function(){d.end()}}a.inmobi.OldTap=g;g.prototype.click=function(){this.c||this.b()};g.prototype.start=function(b){this.a=this.c=!0;b&&b.preventDefault()};g.prototype.end=function(){this.a&&(this.a=!1,this.b())};})();\n\n	new window.inmobi.Bolt({\"lp\":\"https://itunes.apple.com/app/uber/id368677368?mt\\u003d8\\u0026ct\\u003dInMobi\",\"lps\":\"https://itunes.apple.com/app/uber/id368677368?mt\\u003d8\\u0026ct\\u003dInMobi\",\"ct\":[\"https://36210.measurementapi.com/serve?action\\u003dclick\\u0026publisher_id\\u003d36210\\u0026site_id\\u003d17688\\u0026agency_id\\u003d608\\u0026ref_id\\u003d109f95b2-0155-1000-d565-429c5fa80090\\u0026unid\\u003dFC0F3445-0FCE-40EE-8646-3CA8BB2663EA\\u0026sub_placement\\u003dGWL2I9EN\\u0026sub_campaign\\u003dDisplay-Inmobi-Fetch_1_-99_US-national_R_iOS_ACQ_CPI_en_Ongoing\\u0026sub_adgroup\\u003dA081_A064_C625845\\u0026sub_ad\\u003d16039-MD-R-Photo-Q1-Refresh-Rd-2-US_Woman-3-GoingSomewhereTakeUber_320x480\",\"http://c.w.inmobi.com/c.asm/C/t/eaqys9splx/1blu/r/2m/ba/u/0/0/0/eyJVSUQiOiJGQzBGMzQ0NS0wRkNFLTQwRUUtODY0Ni0zQ0E4QkIyNjYzRUEiLCJJREEiOiJGQzBGMzQ0NS0wRkNFLTQwRUUtODY0Ni0zQ0E4QkIyNjYzRUEifQ~~/109f95b2-0155-1000-d565-429c5fa80090/-1/0/-1/1/0/x/12887725/NW/2t/0/api/3.1.0/dir/Y29tLm1pZGFzcGxheWVyLmFwcHMuY2FuZHljcnVzaHNhZ2E~/FqDvDxaA9bIMFoKnn-rIVDdEUC-4uk18PxQeFwAAAAAAAPA_FwAAAAAAAAAAF6RwPQrXo8A_FAISGDg1TE11NER6NDQybFlLeVlJek1YdWQwbjJlRm5URTFnSDNnWFpDOXNLeDZkL20zZDB3SCtzeFE9PRgGTkFUSVZFHBQAFAIcHBaAwKiVwOzKnyEW39m4-ZvZ3tJUABbQ-vn5v6P-viEVABIAADkFIhQAForC4OnbUSgQd2ViMTA2NS5hZHMuaGtnMRQCEjwVAgAsFQIAAA/-1/AA/6/12447bb2?at\\u003d1\\u0026am\\u003d0\"],\"bcu\":\"http://et.w.inmobi.com/c.asm/C/t/eaqys9splx/1blu/r/2m/ba/u/0/0/0/eyJVSUQiOiJGQzBGMzQ0NS0wRkNFLTQwRUUtODY0Ni0zQ0E4QkIyNjYzRUEiLCJJREEiOiJGQzBGMzQ0NS0wRkNFLTQwRUUtODY0Ni0zQ0E4QkIyNjYzRUEifQ~~/109f95b2-0155-1000-d565-429c5fa80090/-1/0/-1/0/0/x/12887725/NW/2t/0/api/3.1.0/dir/Y29tLm1pZGFzcGxheWVyLmFwcHMuY2FuZHljcnVzaHNhZ2E~/FqDvDxaA9bIMFoKnn-rIVDdEUC-4uk18PxQeFwAAAAAAAPA_FwAAAAAAAAAAF6RwPQrXo8A_FAISGDg1TE11NER6NDQybFlLeVlJek1YdWQwbjJlRm5URTFnSDNnWFpDOXNLeDZkL20zZDB3SCtzeFE9PRgGTkFUSVZFHBQAFAIcHBaAwKiVwOzKnyEW39m4-ZvZ3tJUABbQ-vn5v6P-viEVABIAADkFIhQAForC4OnbUSgQd2ViMTA2NS5hZHMuaGtnMRQCEjwVAgAsFQIAAA/-1/AA/6/fd482491\",\"ws\":false,\"ns\":\"im_4194_\",\"sc\":true});\n	new window.inmobi.OldTap(\"im_4194_\", function() {\n	window['im_4194_openLandingPage']();\n	window['im_4194_recordEvent'](8);\n});\n</script>","namespace":"im_4194_"}   ],"requestId" : "109f956b-0155-1000-fc00-3ec000000090" }
		

Interstitial Ads

{
   "ads":[
       {
           "pubContent":"plain text",
		"adtype": " ",
		 "width": ,
"height": ,
"lp": ,
       },
 {
           "pubContent":"plain text",
		 "adtype": " ",
		 "width": ,
"height": ,
"lp": ,
       }
	  .
	  .
	  .
   ],
   "requestId":""
}
		
Response for No-Fill
{
    "ads":[
    ],
    "requestId":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
		
Description
  • ads: The Ads object contains one or more ads which can be rendered within the publisher property
  • pubContent: The pubContent contains a render ready HTML snippet which must be used as is to display the ad

    • Base 64 decoding of the Pub content results in a JSON response, which contains the necessary meta information for the creative.
    • In the example above, the value displays the meta information like this {"landing_url":"https://play.google.com/store/apps/details?id\u003dcom.toptable","cta":"Download","icon_ad":{"w":1 94,"url":"http://mkhoj-av.s3.amazonaws.com/com.toptable-ANDROID-us-1345243w194h310","h":310}}
    • The K-V pair for this JSON are generated in the way as desired by the publisher.
    • For native ads: The information present in the JSON will have the necessary information required for creating a native ad.
  • Native Ads:
    • eventTracking:Contains a set of event URLs.
  • requestId: This is an identifier generated by InMobi denoting the request. This parameter is used to debug issues or identify ads which might have problems.
  • adtype: The type of ad contained in the response. Possible values are text, banner, rm.
  • width: The width of the ad creative.
  • height: The height of the ad creative.
  • lp:The click URL of the ad.

Integrating Native Ads

Parsing the Ad Response

A successful ad request results in an ad response as per the following template:

{
    "ads":[
        {
            "pubContent":"Json of ad resources",
            "landingPage":"",
            "beaconUrl":"",
		"eventTracking":
		{
		 "eventvalue":
		 {
 		  "urls”:[]
	       },
	       "eventvalue":
		 {
 		  "urls”:[]
	       },
		},
        },
        {
            "pubContent":"Json of ad resources",
            "landingPage":"",
            "beaconUrl":"",
		"eventTracking":
		{
		 "eventvalue":
		 {
 		  "urls”:[]
	       },
	       "eventvalue":
		 {
 		  "urls”:[]
	       },
		},
        },
	  .
	  .
	  .
    ],
    "requestId":""
}
		

A sample JSON value in the pubContent is shown below:

{
    "title":"Amazon App",
    "description":"Comprehensive Browse, search, get product details, read reviews and purchase millions of products",
    "icon":{
        "height":300,
        "width":300,
        "aspectRatio":1.0,
        "url":"http://uac-assets.inmobicdn.net/297606951-us-1448064792715"
    },
    "screenshots":{
        "height":480,
        "width":320,
        "aspectRatio":0.66,
        "url":"http://r.edge.inmobicdn.net/FileData/d2ea997b-c370-4d12-8ace-373251018df5.png"
    },
    "landingURL":"https://itunes.apple.com/app/amazon-app-shop-browse-scan/id297606951?mt\u003d8"
}
		

Each JSON parameter represents an ad asset. From the example above,

  • title: Represents the title of the ad
  • description: Description of the app on the store
  • landingURL: Represents the landing URL of the ad
  • screenshot: Represents the image associated with the ad
  • icon: Represents the Store App icon

Note: The list of fields above is not exhaustive; they have been used only as a sample. You can configure the ad template as per your site layout.

Rendering the Native Ads

Native ad rendering is completely controlled by the publisher. The publisher can decide how to handle layout and placement of the assets based the app's design and layout.

Along with rendering the ad, the publisher must also ensure events related to the ad render and click are transmitted to InMobi. For this, the steps below must be followed:

  • Fire impressions when the ad is rendered and visible on the screen.
  • Fire clicks when the ad is interacted with.

To conform to MRC’s viewability guidelines, the render beacon must only be fired when at least 50% of the ad unit is visible on the screen for at least 1 second.

The following table elicits the various event beacon values.

Interaction ID When to Fire
CTA (m=8) On click
RENDER (m=18) For new creatives, the recommendation is this needs to be done at top level record event, so that it counts render for the whole ad unit.
CLIENT_FILL (m=120) (Optional) In case the client side cache is implemented, this beacon should be fired whenever an ad unit is extracted from the cache for rendering. This helps in accurately tracking the true fill and render rates.

Recording impressions and clicks on the Native Ads

To record impression/ click on the native-ad, follow these steps:

  1. Get the list of urls based on event id eventTracking
    • For example, 8 for click, 18 for render etc.
  2. Get the list of URLs for that event for the ad.
  3. For each tracker url, do the following:
    1. Send a GET request to the urls, with an http client.
    2. Retry up to 5 times if the url fails, with an exponential backoff defined by retryTime * Uniform[0, 1], and retryTime doubled for every failure with start retry time as 1 second.
    3. Follow redirects, stop if you find a non http and non https url and mark the ping as successful.
  4. For custom event tracking:
    • Fetch the beaconUrl and append the custom event id: beaconUrl?m=id, id being the event id.

Note:

  • Impression: We recommend calling the impression function when the ad is actually displayed to the user.
  • Click: We recommend calling the click function when the ad is actually clicked by the user.

Handling landing pages

  • Fetch the value from landingPage.

Testing the Integration

Publishers can utilize the InMobi Diagnostics tool for testing integration. See the Setting Up Publisher Diagnostics topic for more details.

Ad Sizes

Parameter Value Ad Size Intended Inventory
1 120x20 All Phones (Feature Phones, iOS, Android, Windows)
2 168x28 All Phones (Feature Phones, iOS, Android, Windows)
3 216x36 All Phones (Feature Phones, iOS, Android, Windows)
4 300x50 All Phones (Feature Phones, iOS, Android, Windows)
9 320x48 Smartphones and Tablets (iOS, Android, Windows, Others)
10 300x250 Smartphones and Tablets (iOS, Android, Windows, Others)
11 728x90 Smartphones and Tablets (iOS, Android, Windows, Others)
12 468x60 Smartphones and Tablets (iOS, Android, Windows, Others)
13 120x600 Smartphones and Tablets (iOS, Android, Windows, Others)
14 320x480 Smartphones and Tablets (iOS, Android, Windows, Others) – Portrait Interstitial ads
32 480x320 Smartphones and Tablets (iOS, Android, Windows, Others) – Landscape Interstitial ads
15 320x50 Smartphones and Tablets (iOS, Android, Windows, Others)
33 1024x768 Tablets (iOS, Android, Windows) – Landscape Interstitial ads
16 768x1024 Tablets (iOS, Android, Windows) – Portrait Interstitial ads
34 1280x800 Tablets (iOS only) – Landscape Interstitial ads
17 800x1280 Tablets (iOS only) – Portrait Interstitial ads
18 160x600 Smartphones and Tablets (iOS, Android, Windows, Others)
21 480x75 Smartphones and Tablets (Windows)
27 500x130 Smartphones and Tablets (Windows)
28 292x60 Smartphones and Tablets (Windows)
29 250x250 Smartphones and Tablets (Windows)
30 250x125 Smartphones and Tablets (Windows)

Appendix

Valid Category Values

The table below contains the acceptable list of string values. Please pass comma-separated list of categories of the property during the request.

Parameter Value

Parameter description

im1

Books & Reference

im2

Business

im3

Catalogs

im4

Comics

im5

Communication

im6

Education

im7

Entertainment

im8

Finance

im9

Food & Drink

im10

Games

im10-1

Action

im10-2

Adventure

im10-3

Arcade

im10-4

Board

im10-5

Card

im10-6

Casino

im10-7

Dice

im10-8

Educational

im10-9

Family

im10-10

Kids

im10-11

Music

im10-12

Puzzle

im10-13

Racing

im10-14

Role Playing

im10-15

Simulation

im10-16

Sports

im10-17

Strategy

im10-18

Trivia

im10-19

Word

im10-20

Health & Fitness

im10-21

Lifestyle

im10-22

Media & Video

im10-23

Medical

im10-24

Music & Audio

im11

News & Magazines

im11-1

Arts & Photography

im11-2

Automotive

im11-3

Brides & Weddings

im11-4

Business & Investing

im11-5

Children's Magazines

im11-6

Computers & Internet

im11-7

Cooking, Food & Drink

im11-8

Crafts & Hobbies

im11-9

Electronics & Audio

im11-10

Entertainment

im11-11

Fashion & Style

im11-12

Health, Mind & Body

im11-13

History

im11-14

Home & Garden

im11-15

Literary Magazines & Journals

im11-16

Men's Interest

im11-17

Movies & Music

im11-18

News & Politics

im11-19

Outdoors & Nature

im11-20

Parenting & Family

im11-21

Pets

im11-22

Professional & Trade

im11-23

Regional News

im11-24

Science

im11-25

Sports & Leisure

im11-26

Teens

im11-27

Travel & Regional

im11-28

Women's Interest

im12

Personalization

im13

Productivity

im14

Shopping

im15

Social Networking

im16

Software Libraries and Demos

im17

Sports

im18

Tools

im19

Travel & Local

im20

WAP Portals

im21

Weather

Versioning

API versions are maintained using the endpoint to which ad requests need to be sent. For example: http://api.w.inmobi.com/showad/v3.1

  • Patch version updates are bug fixes and will not affect the endpoint. For example: API version 3.1.1
  • Minor version updates are additional support for new values in existing parameters. These will reflect on the endpoint. For example, API version 3.2.0.
  • Major version releases will have an impact on the endpoint. For example, Version 4.0.0.

exchange | VAST (Server to Server)

exchange | VAST (Client to Server)

exchange | Passing p-chain value

exchange | How To Set Up AdMob As An Ad Source

Ad Source Details:

Requirements:

  • AerServ SDK (iOS | Android)
  • Android requires updating the Android Manifest and gradle.build file

 

 

How to Set Up the AdMob Ad Source

 

 

Step 1:   Log on to http://platform.aerserv.com/ and click on the Ad Sources link at the top of the page.

Step 2:   Click the + or the Add New Ad Source button on the page.

Step 3:   Enter a Name for the ad source (example: AdMob Interstitial).

Step 4:   Select AdMob (SDK) as the ad source.

Step 5:    Select Interstitial HTML, Banner HTML, Video, SmartBanner, or Rewarded Video in the Ad Type drop down menu.

 
Please Note: Android SDK versions 3.1.2 and higher & iOS SDK versions 3.1.2.1 and higher support AdMob Rewarded Video through the "Video" Ad Type.

 

Step 6:   Enter the following fields that are specific to the AdMob ad source:

 

FIELD DESCRIPTION REQUIRED/OPTIONAL
Ad Unit ID

A unique ID number assigned to each of your ad units when they're created in AdMob. The ad unit ID is added to your apps code and used to identify ad requests from the ad unit.

Required

 

Step 7: Enter in the appropriate banner size in "AdMob Banner Size" field if you chose "Banner HTML" as the Ad Type.

Step 8: Enter estimated CPM (e.g. 3.50). This value is used as the default CPM, not the floor.

Step 9: Select desired Placement.

Step 10: Select Country or DMA targeting.

Step 11: Select Device targeting.

Step 12: Click Save.

 

Locating the AdMob Credentials 

credentials_admob.png

Step 1: On your AdMob dashboard, click Apps in the sidebar

Step 2: Click the name of the app associated with the ad unit. Note: If you don't see it in the list of recent apps, you can click View All Apps, then click the name of the app

Step 3: Click Ad units in the sidebar

Step 4: Click the Copy icon in the Ad unit ID (1) column to copy the ID of the ad unit

 

Android 

icon_android-on.png
AerServ SDK
download-sdk.png

 

Step 1. Add the following settings inside your application's build.gradle


dependencies {
    compile 'com.google.android.gms:play-services-ads:10.2.1'
}
 
If you are using Android Studio and don't have the following version of play-services, the SDK Manager will prompt you to download the version. 

Step 2.   Add the following activity to your AndroidManifest.xml

<activity 
  android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

 

iOS 

image.jpg
AerServ SDK
download-sdk.png

 

Step 1.   Add the AdMob SDK in the folder network-support/AdMob/GoogleMobileAds.framework into your project frameworks.

Add the following libraries and frameworks to Target > Build Phases > Link Binary With Libraries:

AdSupport.framework (Set to Optional)
AudioToolbox.framework
AVFoundation.framework
CoreGraphics.framework
CoreMedia.framework
CoreMotion.framework CoreTelephony.framework
CoreVideo.framework EventKit.framework
EventKitUI.framework
GoogleMobilesAds.framework
GLKit.framework JavaScriptCore.framework (Set to Optional) MediaPlayer.framework
MessageUI.framework
OpenGLES.framework SafariServices.framework (Set to Optional) StoreKit.framework SystemConfiguration.framework
MobileCoreServices.framework

Step 2.   Add the following entry into your info.plist: 

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>

exchange | iOS

Prerequisites

  • The latest version of InMobi Mediation SDK supports iOS 9 or higher. Also, this version of iOS Mediation SDK requires XCode 10.2 or higher.
  • We recommend to call all InMobi Mediation APIs on main thread.

Step 1: Integrating the SDK

  • Step 1.1: Download the InMobi SDK

    a. Download the latest InMobi SDK below. We also provide the option to use CocoaPods!

    Download the InMobi iOS Mediation SDK here.

    The SDK bundle contains all media adapters that we support. Prune the downloaded folder to retain the media adapters you need.


    b. CocoaPods (Optional)

    In the same directory as your YOUR_PROJECT.xcodeproj, create an empty file named Podfile and copy and paste the following:

              platform :ios, '9.0'
              target 'APP_NAME' do
                    pod 'InMobiMediationSDK'
              end
    		

    Ensure your project has been closed. Using the terminal, navigate to the directory containing the Podfile and run the command: pod install. Once the installation finishes, use YOUR_PROJECT.xcworkspace to access your project moving forward.

    Inside the xcworkspace there should be a Pods directory included with an ios-sdk-pod sub-directory.

    Warning: Please remove all older versions of the InMobi SDK (8.X.X and older) and all older versions of the AerServ SDK. Otherwise, your code will not compile! Please reach out to your account manager if you have any questions. If you are using CocoaPods, be sure to remove the 'aerserv-ios-sdk' pod from your podfile and only use the 'inmobi-ios-sdk' pod.

  • Step 1.2: Add the Required Libraries

    Add the following framework into your project from the InMobi SDK download:

    • InMobiSDK.framework
    • InMobiMediationSDK.framework

    All supported mediation partner libraries and headers are present in the network-support folder, please add the mediation partners as per choice.

    Note: When using any mediation through the InMobi SDK, it is highly recommended that you use the framework that is provided along with the InMobi SDK download. These versions have been tested by our team and using any other version may not be officially supported.

  • Step 1.3: General Settings

    Under the General tab within your project's target, you'll need to add the following settings:

    • Select all desired Device Orientation inside 'Deployment Info'.
    • Add the following dependencies to Linked Frameworks and Libraries:
      • WebKit.framework
      • libsqlite3.0.tbd
      • libz.tbd
  • Step 1.4: Create a bridging header (Swift Only)

    You will need to create a bridging header if your application is built with Swift. The bridging header exposes the Objective-C implementation to Swift. To create the bridging header, you'll need to do the following:

    1. Create a new header file, InMobiSDK-Bridging-Header.h.
    2. Add the following entry to the Bridging Header:
      #import <InMobiSDK/InMobiSDK.h>
      			
    3. Add the newly created header file's path to the target'sBuild Setting->Linking->Objective-C Bridging Header

  • Step 1.5: Build Settings

    Add the following flags to the target's Build Setting->Linking->Other Flag:

    • -ObjC

  • Step 1.6: Info.plist

    You will need to add the following entries into your info.plist:

    <key>LSApplicationQueriesSchemes</key>
    <array>
    <string>fb</string>
    <string>instagram</string>
    <string>tumblr</string>
    <string>twitter</string>
    </array>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Location is used to help target content to your general area</string>
    <key>NSCalendarsUsageDescription</key>
    <string>Some ad content may create a calendar event.</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Some ad content may require access to the photo library.</string>
    <key>NSCameraUsageDescription</key>
    <string>Some ad content may access camera to take picture.</string>
    <key>NSMotionUsageDescription</key>
    <string>Some ad content may require access to accelerometer for interactive ad experience.</string>
    		

    Note: For iOS 9 and above, you will need to disable App Transport Security (ATS).
    We recommend that you disable ATS to improve fill rates. Should you choose to leave ATS enabled, your monetization may get affected! Please refer here for more detail.
    Please reach out to your account manager for any further questions you may have.

Step 2: Initializing the InMobi SDK

You must initialize our SDK before loading any ads. Initializing InMobi SDK will update server-side configurations and additionally initialize any mediated ad sources.

Within the AerServ + InMobi dashboard, click on the inventory tab and edit the specific application that is being integrated. There will be an App ID associated with that application. Use that App ID to call InMobi SDK's initializeWithAppID:. Suggested place to kick off the initialization process is in the application's AppDelegate inside the application:didFinishLaunchingWithOptions: method.

It is recommended that you initialize the InMobi SDK as early as possible and 10 seconds before making your first ad request.

  • Objective-C
    /*!
         * Looks into the supplied app id and will run pre-initialization for any mediation partner sources that requires an extra setup phase.
         *
         * @param appId a string of the app id
         * @param error error object to be populated if initialization is not completed
    */
    + (void)initializeWithAppID:(NSString*)appId andError:(NSError * _Nullable * _Nonnull)error;
    /**
         * Initialize the sdk. This must be called before any other API for the SDK is used.
         * @param appId App id obtained from the Aerserv portal.
         * @param consentDictionary InMobi relies on the publishers to obtain explicit consent from users for continuing business activities in EU as per GDPR . Consent dictionary allows publishers to indicate consent status as obtained from the users for InMobi services to function appropriately.
         * It has Three optional keys:"gdpr", IM_GDPR_CONSENT_AVAILABLE, IM_GDPR_CONSENT_IAB
         * "gdpr"(String): Whether or not the request is subjected to GDPR regulations (0 = No, 1 = Yes), omission indicates Unknown.
         * IM_GDPR_CONSENT_AVAILABLE(string): "true" : User has provided consent to collect and use data.
         *                                    "false": User has not provided consent to collect and use data.
         * IM_GDPR_CONSENT_IAB(string): Key to send the IAB consent string.
         * @param error error object to be populated if initialization is not completed
     */
     + (void)initializeWithAppID:(NSString*)appId andUserConsent:(nullable NSDictionary *)consentDictionary andError:(NSError     * _Nullable     * _Nonnull)error;
    /*!
     	* updates the user consent for a session of the app
     	* @param consentDictionary consent dictionary allows publishers to provide its consent to collect user data and use it.
     	* It has Three optional keys:"gdpr", IM_GDPR_CONSENT_AVAILABLE, IM_GDPR_CONSENT_IAB
     	* "gdpr"(String): Whether or not the request is subjected to GDPR regulations (0 = No, 1 = Yes), omission indicates Unknown.
     	* IM_GDPR_CONSENT_AVAILABLE(string): "true" : User has provided consent to collect and use data.
     	* "false": User has not provided consent to collect and use data.
     	* IM_GDPR_CONSENT_IAB(string): Key to send the IAB consent string.
     	*/
    + (void)setGDPRWithUserConsent:(NSDictionary *)consentDictionary;
    		

How to obtain the app ID:

  • Log in to the AerServ + InMobi platform.
  • Go to the 'Inventory' tab in the top navigation bar.
  • Click the 'Edit' icon next to the app whose ID you wish to obtain.
  • You will find the app ID at the very top of the page.

To set or update the General Data Protection Regulation (GDPR) user consent flag, call InMobi SDK’s +setGDPRWithUserConsent: method. Pass a dictionary with InMobi provided keys:

{	IM_GDPR_CONSENT_AVAILABLE : “true”,
		IM_GDPR_CONSENT_IAB : <IAB STRING>
}
	

If user consent was granted and if user consent was denied or unknown change IM_GDPR_CONSENT_AVAILABLE value to “FALSE” in the above dictionary.

To have the GDPR user consent flag to be set before an ad request, call +setGDPRWithUserConsent: before calling -loadAd. The values passed into +setGDPRWithUserConsent: will be stored in the NSUserDefaults, persisting the chosen consent. Thus, it is not necessary to reset the user consent value prior to each ad request; the value set is applicable for all subsequent requests until that value is reset.

An example would be:

  • Objective-C
    NSDictionary *consentDictionary =   @{IM_GDPR_CONSENT_AVAILABLE: @"true",IM_GDPR_CONSENT_IAB: @"iabConsentString"};
    [AerServSDK initializeWithAppID:@"APP_ID" andUserConsent:consentDictionary andError:&error];
    if(error) {
        NSLog(@"**** ERROR: Failed to initialize with error %@. ****",error.description);
    }
    // or
    [AerServSDK initializeWithAppID:@"APP_ID" andError:&error];
    if(error) {
        NSLog(@"**** ERROR: Failed to initialize with error %@. ****",error.description);
    }
    [AerServSDK setGDPRWithUserConsent:consentDictionary];
    		
  • Swift
    let consentDictionary : [String:String] = [IM_GDPR_CONSENT_AVAILABLE : "true", IM_GDPR_CONSENT_IAB : "iabConsentString"]
    AerServSDK.initialize(withAppID: "APP_ID", andUserConsent: consentDictionary, andError: &error)
    if((error) != nil) {
        print("**** ERROR: Failed to initialize with error %@. ****",error?.description as Any);
    }
    // or
    AerServSDK.initialize(withAppID: "APP_ID", andError: &error)
    if((error) != nil) {
        print("**** ERROR: Failed to initialize with error %@. ****",error?.description as Any);
    }
    AerServSDK.setGDPRWithUserConsent(consentDictionary)
    		

Mediation Disclaimer: Please be advised that although we are GDPR compliant, we currently have no way to send GDPR compliance as well as user consent to our mediated SDK partners. Compliance responsibility and request handling will solely depend on the SDK mediated partner. Please contact your mediated partners to avoid any issues and/or complications.

Step 3: Displaying Banner Ads

  • Step 3.1: Loading and Showing Banners

    • Create an ASAdView object by passing in a placement setup on the AerServ + InMobi dashboard as well as the banner's size. Refer to ASAdView.h for InMobi SDK's predefined sizes.
      • Objective-C
        #import <InMobiSDK/InMobiSDK.h>
        @interface ViewController()
        @property(nonatomic, strong) ASAdView* asAdView;
        @end
        @implementation ViewController
        - (void)loadBannerAd {
          // Create the AerServ banner object
          self.asAdView = [ASAdView viewWithPlacementID:@"1024876" andAdSize:ASBannerSize];   
        }
        @end
        				
      • Swift
        class ViewController: UIViewController, {
          var asAdView: ASAdView?
          func loadBannerAd() {
            // Create the AerServ banner object
            asAdView? = ASAdView(placementID: "1024876", andAdSize: ASBannerSize)
          }
        }
        				

    • Add the ASAdView object to your application's view.
      • Objective-C
        #import <InMobiSDK/InMobiSDK.h>
        @interface ViewController()
        @property(nonatomic, strong) ASAdView* asAdView;
        @end
        @implementation ViewController
        - (void)loadBannerAd {
          // Create the AerServ banner object
          self.asAdview = [ASAdView viewWithPlacementID:@"1024876" andAdSize:ASBannerSize];
          // Add banner to a parent view
          [self.view addSubview:asAdView];
        }
        @end
        				
      • Swift
        class ViewController: UIViewController {
          var asAdView: ASAdView?
          func loadBannerAd() {
            // Create the AerServ banner object
            asAdView? = ASAdView(placementID: "1024876", andAdSize: ASBannerSize)
            // Add banner to a parent view
            view.addSubview(asAdView!)
          }
        }
        				
    • In the view controller that the ASAdView object is added to, make sure that the view controller adheres to the ASAdViewDelegate protocol. Additionally, add the callback -viewControllerForPresentingModalView that will return itself.
      • Objective-C
        #import <InMobiSDK/InMobiSDK.h>
        @interface ViewController() <ASAdViewDelegate>
        @property(nonatomic, strong) ASAdView* asAdView;
        @end
        @implementation ViewController
        - (void)loadBannerAd {
          // Create the AerServ banner object
          self.asAdview = [ASAdView viewWithPlacementID:@"1024876" andAdSize:ASBannerSize];
          self.asAdview.delegate = self;
          // Add banner to a parent view
          [self.view addSubview:asAdView];
        }
        #pragma mark - AerServ Interstitial Callbacks 
        - (UIViewController*)viewControllerForPresentingModalView {
          return self;
        }
        @end
        				
      • Swift
        class ViewController: UIViewController, ASAdViewDelegate {
          var asAdView: ASAdView?
          func loadBannerAd() {
            // Create the AerServ banner object
            asAdView? = ASAdView(placementID: "1024876", andAdSize: ASBannerSize)
            asAdView?.delegate = self
            // Add banner to a parent view
            view.addSubview(asAdView!)
          }
          //MARK: AerServ Banner Callback
          func viewControllerForPresentingModalView() -> UIViewController! {
            return self  
          }
        }
        				
    • Lastly, kick off the ad request by loading the ad.
      • Objective-C
        #import <InMobiSDK/InMobiSDK.h>
        @interface ViewController() <ASAdViewDelegate>
        @property(nonatomic, strong) ASAdView* asAdView;
        @end
        @implementation ViewController
        - (void)loadBannerAd {
          // Create the AerServ banner object
          self.asAdview = [ASAdView viewWithPlacementID:@"1024876" andAdSize:ASBannerSize];
          self.asAdview.delegate = self;
          // Add banner to a parent view
          [self.view addSubview:asAdView];
          // Use loadAd to make a request to the AerServ ad server for an ad
          [self.asAdView loadAd];
        }
        #pragma mark - AerServ Banner Callbacks
        - (UIViewController*)viewControllerForPresentingModalView {
          return self;
        }
        @end
        				
      • Swift
        class ViewController: UIViewController, ASAdViewDelegate {
          var asAdView: ASAdView?
          func loadBannerAd() {
            // Create the AerServ banner object
            asAdView? = ASAdView(placementID: "1024876", andAdSize: ASBannerSize)
            asAdView?.delegate = self
            // Add banner to a parent view
            view.addSubview(asAdView!)
            // Use loadAd to make a request to the AerServ ad server for an ad
            asAdView?.loadAd()
          }
          //MARK: AerServ Banner Callback
          func viewControllerForPresentingModalView() -> UIViewController! {
            return self  
          }
        }
        				

  • Step 3.2: Optional Banner Callbacks

    You can additionally assign a delegate to listen for the banner's callback events. A few of the callbacks that can be listened to are:

    • Objective-C
      #pragma mark - AerServ Banner Callbacks
      - (void)adViewDidLoadAd:(ASAdView*)adView { }
      - (void)adViewDidPreloadAd:(ASAdView*)adView { }
      - (void)adViewDidFailToLoadAd:(ASAdView*)adView withError:(NSError*)error { }
      - (void)adWasClicked:(ASAdView*)adView { }
      			
    • Swift
      //MARK: AerServ Banner Callbacks
      func adViewDidLoadAd(_ adView: ASAdView!) { }
      func adViewDidPreloadAd(_  adView: ASAdView!) { }
      func adViewDidFail(toLoadAd adView: ASAdView!, withError error: Error!) { }
      func adWasClicked(_ adView: ASAdView!) { }
      			

    Please refer to ASAdView.h for all available callbacks and descriptions of each. Settings for specifying the banner refresh time interval, preloading, and more can be found in the ASAdView header as well.

Step 4: Displaying Interstitial Ads

  • Step 4.1: Loading and Displaying Interstitials

    • Create an ASInterstitialViewController object with a placement setup on the AerServ + InMobi dashboard and a delegate that conforms to ASInterstitialViewControllerDelegate.
      • Objective-C
        #import <InMobiSDK/InMobiSDK.h>
        @interface ViewController() <ASInterstitialViewControllerDelegate>
        @property(nonatomic, strong) ASInterstitialViewController* asInterstitialVC;
        @end
        @implementation ViewController
        - (void)loadInterstitialAd {
          // Create the AerServ interstitial object
          self.asInterstitialVC = [ASInterstitialViewController viewControllerForPlacementID:@"1000741" withDelegate:self];
        }
        @end
        				
      • Swift
        import AerServSDK
        class ViewController: UIViewController, ASInterstitialViewControllerDelegate {
          var asInterstitialVC: ASInterstitialViewController?
          func loadInterstitialAd() {
            // Create the AerServ interstitial object
            asInterstitialVC? = ASInterstitialViewController(forPlacementID: "1000741", with: self)
          }
        }
        				

    • Start the ad request by loading an ad with your specified settings.
      • Objective-C
        #import <InMobiSDK/InMobiSDK.h>
        @interface ViewController() <ASInterstitialViewControllerDelegate>
        @property(nonatomic, strong) ASInterstitialViewController* asInterstitialVC;
        @end
        @implementation ViewController
        - (void)loadInterstitialAd {
          // Create the AerServ interstitial object
          self.asInterstitialVC = [ASInterstitialViewController viewControllerForPlacementID:@"1000741" withDelegate:self];
          // Use loadAd to make a request to the AerServ ad server for an ad
          [self.asInterstitialVC loadAd];
        }
        @end
        				
      • Swift
        class ViewController: UIViewController, ASInterstitialViewControllerDelegate {
          var interstitial: ASInterstitialViewController?
          func loadInterstitialAd() {
            // Create the AerServ interstitial object
            asInterstitialVC? = ASInterstitialViewController(forPlacementID: "1000741", with: self)
            // Use loadAd to make a request to the AerServ ad server for an ad
            asInterstitialVC?.loadAd()
          }
        }
        				
    • When the ad is ready, a callback event will be triggered. From the callback, the interstitial ad can be shown from a parent view controller.
      • Objective-C
        #import <InMobiSDK/InMobiSDK.h>
        @interface ViewController() <ASInterstitialViewControllerDelegate>
        @property(nonatomic, strong) ASInterstitialViewController* asInterstitialVC;
        @end
        @implementation ViewController
        - (void)loadInterstitialAd {
          // Create the AerServ interstitial object
          self.asInterstitialVC = [ASInterstitialViewController viewControllerForPlacementID:@"1000741" withDelegate:self];
          // Use loadAd to make a request to the AerServ ad server for an ad
          [self.asInterstitialVC loadAd];
        }
        #pragma mark - AerServ Interstitial Callbacks
        - (void)interstitialViewControllerAdLoadedSuccessfully:(ASInterstitialViewController*)viewController {
          [viewController showFromViewController:self];
        }
        @end
        				
      • Swift
        class ViewController: UIViewController, ASInterstitialViewControllerDelegate {
          var asInterstitialVC: ASInterstitialViewController?
          func loadInterstitialAd() {
            // Create the AerServ interstitial object
            asInterstitialVC? = ASInterstitialViewController(forPlacementID: "1000741", with: self)
            // Use loadAd to make a request to the AerServ ad server for an ad
            asInterstitialVC?.loadAd()
          }
          //MARK: AerServ Interstitial Callbacks
          func interstitialViewControllerAdLoadedSuccessfully(_ viewController: ASInterstitialViewController!) {
            asInterstitialVC?.show(from: self)
          } 
        }
        				

  • Step 4.2: Optional Interstitial Steps

    Preloading Interstitial Ads

    Preloading an ad works in a similar fashion. Before loading the ad, the isPreload flag should be set to YES. Another callback event can be listened to for notification that a preloaded ad is ready to be shown.

    • Objective-C
      #import <InMobiSDK/InMobiSDK.h>
      @interface ViewController() <ASInterstitialViewControllerDelegate>
      @property(nonatomic, strong) ASInterstitialViewController* asInterstitialVC;
      @property(nonatomic) BOOL didPreload;
      @end
      @implementation ViewController
      /**
       * We check if the preload flag has been previously set. This is so that we don't waste an ad that has already been preloaded
       * and calling another load won't necessary fill.
       */
      - (void)loadAd {
        if(!self.didPreload) {
          self.asInterstitialVC = [ASInterstitialViewController viewControllerForPlacementID:@"1000741" withDelegate:self];
          self.asInterstitialVC.isPreload = YES;
          [self.asInterstitialVC loadAd];
        } else {
          NSLog(@"--- Ad is already loaded ---");
        }
      }
      - (void)showAd {
        if(self.didPreload) {
          [self.asInterstitialVC showFromViewController:aViewController];
        } else {
          NSLog(@"--- Interstitial hasn't preloaded ---");
        }
      }
      #pragma mark - AerServ Interstitial Callbacks
      - (void)interstitialViewControllerDidPreloadAd:(ASInterstitialViewController*)viewController {
        NSLog(@"--- Interstitial View Controller Did Preload Ad ---");
        self.didPreload = YES;
        // - [self.asInterstitialVC showFromViewController] can be called anything after this point.
      }
      - (void)interstitialViewControllerAdFailedToLoad:(ASInterstitialViewController*)viewController withError:(NSError*)error {
        NSLog(@"--- Interstitial ad failed: ', error, ' ---");
        self.didPreload = NO;
      }
      - (void)interstitialViewControllerDidDisappear:(ASInterstitialViewController*)viewController {
        NSLog(@"--- Interstitial ad did disappear ---");
        self.didPreload = NO;
      }
      @end
      			
    • Swift
      class ViewController: UIViewController, ASInterstitialViewControllerDelegate {
        var asInterstitialVC: ASInterstitialViewController?
        var didPreload = false
        /**
         * We check if the preload flag has been previously set. This is so that we don't waste an ad that has already been preloaded
         * and calling another load won't necessary fill.
         */
        func loadAd() {
          if(!didPreload) {
            asInterstitialVC? = ASInterstitialViewController(forPlacementID: "1000741", with: self)
            asInterstitialVC?.isPreload = true
            asInterstitialVC?.loadAd()
          }
        }
        func showAd() {
          if(didPreload) {
            asInterstitialVC?.show(from: aViewController)
          } else {
            print("--- Interstitial hasn't preloaded ---")
          }
        }
        //MARK: AerServ Interstitial Callbacks
        func interstitialViewControllerDidPreloadAd(_ viewController: ASInterstitialViewController!) {
          print("---- Interstitial ViewController Did Preload Ad ---")
          didPreload = true
          // interstitial?.show(from: self) can be called anything after this point.
        }
        func interstitialViewControllerAdFailed(toLoad viewController: ASInterstitialViewController!, withError error: Error!) {
          print("--- Interstitial ad failed: ", error, " ---")
          didPreload = false;
        }
        func interstitialViewControllerDidDisappear(_ viewController: ASInterstitialViewController!) {
          print("--- Interstitial ad did disappear ---")
          didPreload = false;
        }
      }
      			
    Additional Interstitial Callbacks

    Other callback events that can be listened to are:

    • Objective-C
      #pragma mark - AerServ Interstitial Callbacks
      - (void)interstitialViewControllerWillAppear:(ASInterstitialViewController*)viewController { }
      - (void)interstitialViewControllerDidAppear:(ASInterstitialViewController*)viewController { }
      - (void)interstitialViewControllerWillDisappear:(ASInterstitialViewController*)viewController { }
      - (void)interstitialViewControllerDidDisappear:(ASInterstitialViewController*)viewController { }
      - (void)interstitialViewControllerAdWasTouched:(ASInterstitialViewController*)viewController { }
      - (void)interstitialViewControllerAdFailedToLoad:(ASInterstitialViewController*)viewController withError:(NSError*)error { }
      			
    • Swift
      //MARK: AerServ Interstitial Callbacks
      func interstitialViewControllerWillAppear(_ viewController: ASInterstitialViewController!) { }
      func interstitialViewControllerDidAppear(_ viewController: ASInterstitialViewController!) { }
      func interstitialViewControllerWillDisappear(_ viewController: ASInterstitialViewController!) { }
      func interstitialViewControllerDidDisappear(_ viewController: ASInterstitialViewController!) { }
      func interstitialViewControllerAdWasTouched(_ viewController: ASInterstitialViewController!) { }
      func interstitialViewControllerAdFailed(toLoad viewController: ASInterstitialViewController!, withError error: Error!) { }
      			

    Please refer to ASInterstitialViewController.h for all available callbacks and descriptions for each. Settings for supplying video player controls, and more can be found in the ASInterstitialViewController header as well.

Step 5: Additional Settings

Virtual Currency

  • Once you have setup your placement with virtual currency, there are two additional callbacks that conform to the protocol ASInterstitialViewControllerDelegate. The first callback will notify that the virtual currency data has loaded.

    • Objective-C
      #import <InMobiSDK/InMobiSDK.h>
      @interface ViewController() <ASInterstitialViewControllerDelegate>
      @property(nonatomic, strong) ASInterstitialViewController* asInterstitialVC;
      @end
      @implementation ViewController
      - (void)loadInterstitialAd {
        self.asInterstitialVC = [ASInterstitialViewController viewControllerForPlacementID:@"1000741" withDelegate:self];
        [self.asInterstitialVC loadAd];
      }
      #pragma mark - AerServ Interstitial Callbacks
      - (void)interstitialViewControllerAdLoadedSuccessfully:(ASInterstitialViewController*)viewController {
        [viewController showFromViewController:self];
      }
      /**
       * The first callback will notify when we load the creative. Note that you can also get the buyerName and buyer price throught the didLoadAdWithTransactionInfo and
       * didShowAdWithTransactionInfo.
       */
      - (void)interstitialViewControllerDidVirtualCurrencyLoad:(ASInterstitialViewController*)viewController vcData:(NSDictionary*)vcData {
        NSString* name = vcData[@"name"];
        NSNumber* rewardAmount = vcData[@"rewardAmount"];
        NSString* buyerName = vcData[@"buyerName"];
        NSNumber* buyerPrice = vcData[@"buyerPrice"];
        // Add your logic here  
      }
      /** 
       * The second callback will notify when the virtual currency has been rewarded. This will only fire after the user has watch 100% of the video on a virtual currency
       * enable placement.
       */
      - (void)interstitialViewControllerDidVirtualCurrencyReward:(ASInterstitialViewController*)viewController vcData:(NSDictionary*)vcData {
        NSString* name = vcData[@"name"];
        NSNumber* rewardAmount = vcData[@"rewardAmount"];
        // Add your logic here  
      }
      @end
      		
    • Swift
      class ViewController: UIViewController, ASInterstitialViewControllerDelegate {
        var asInterstitialVC: ASInterstitialViewController?
        func loadInterstitialAd() {
          asInterstitialVC? = ASInterstitialViewController(forPlacementID: "1000741", with: self)
          asInterstitialVC?.loadAd()
        }
        //MARK: AerServ Interstitial Callback
        func interstitialViewControllerAdLoadedSuccessfully(_ viewController: ASInterstitialViewController!) {
          asInterstitialVC?.show(from: self)
        }
        /**
         * The first callback will notify when we load the creative. 
         */
        func interstitialViewControllerDidVirtualCurrencyLoad(_ viewController: ASInterstitialViewController!, vcData: [AnyHashable : Any]!) {
          let name: String = vcData?["name"] as! String
          let amount: NSNumber = vcData?["rewardAmount"] as! NSNumber
          let buyerName: String = vcData?["buyerName"] as! String
          let buyerPrice: NSNumber = vcData?["buyerName"] as! NSNumber
          // Add your logic here  
        }
        /**
         * The second callback will notify when the virtual currency has been rewarded. This will only fire after the user has watch 100% of the video on a virtual currency 
         * enable placement.
         */
        func interstitialViewControllerDidVirtualCurrencyReward(_ viewController: ASInterstitialViewController!, vcData: [AnyHashable : Any]!) {
          let name: String = vcData?["name"] as! String
          let amount: NSNumber = vcData?["rewardAmount"] as! NSNumber
          // Add your logic here  
        }
      }
      		

    For both of these callbacks, there is a vcData dictionary object attached that will contain the keys "name" and "rewardAmount".

  • Ad Transaction Information

    During the process of showing an ad, the InMobi SDK will additionally return information pertaining to the buyer for your ad space and the price that the ad space was bought for. This detailed information can be found from these callbacks:

    • Objective-C
      #import <InMobiSDK/InMobiSDK.h>
      @interface ViewController() <ASInterstitialViewControllerDelegate, ASAdViewDelegate>
      @property(nonatomic, strong) ASInterstitialViewController* asInterstitialVC;
      @property(nonatomic, strong) ASAdView* asAdView;
      @end
      @implementation ViewController 
      /**
       * When gettings the ad transaction information, no change are needed in how we load the ASInterstitialViewController. We
       * just need to add in the callback.
       */
      - (void)loadInterstitialAd {
        self.asInterstitialVC = [ASInterstitialViewController viewControllerForPlacementID:@"1000741" withDelegate:self];
        [self.asInterstitialVC loadAd];
      }
      /**
       * When gettings the ad transaction information, no change are needed in how we load the ASAdView. We
       * just need to add in the callback.
       */
      - (void)loadBannerAd {
        self.asAdView = [ASAdView viewWithPlacementID:@"1024876" andAdSize:ASBannerSize];
        self.asAdView.delegate = self;
        [self.view addSubview:self.asAdView];
        [self.asAdView loadAd];
      }
      #pragma mark - AerServ Interstitial Callbacks
      - (void)interstitialViewControllerAdLoadedSuccessfully:(ASInterstitialViewController*)viewController {
        [viewController showFromViewController:self];
      }
      /**
       * The didLoadAdWithTransactionInfo callback will contain the transaction information of the ad from the first load attempt. The transaction 
       * information from this callback may be different from the ad the produce the impression.
       */
      - (void)interstitialAdManager:(ASInterstitialAdManager*)viewController didLoadAdWithTransactionInfo:(NSDictionary*)transactionInfo {
        NSString* buyerName = transcationData[@"buyerName"];
        NSNumber* buyerPrice = transcationData[@"buyerPrice"];
        // Add your logic here  
      }
      /**
       * The didShowAdWithTransactionInfo callback will cotanin the transaction information of the ad that produced an impression.  
       */
      - (void)interstitialViewController:(ASInterstitialViewController*)viewController didShowAdWithTransactionInfo:(NSDictionary*)transcationData {
        NSString* buyerName = transcationData[@"buyerName"];
        NSNumber* buyerPrice = transcationData[@"buyerPrice"];
        // Add your logic here  
      }
      #pragma mark - AerServ Banner Callbacks
      - (UIViewController*)viewControllerForPresentingModalView {
        return self;
      }
      /**
       * The didLoadAdWithTransactionInfo callback will contain the transaction information of the ad from the first load attempt. The transaction 
       * information from this callback may be different from the ad the produce the impression.
       */
      - (void)adView:(ASAdView*)adVidew didLoadAdWithTransactionInfo:(NSDictionary*)transcationData {
        NSString* buyerName = transcationData[@"buyerName"];
        NSNumber* buyerPrice = transcationData[@"buyerPrice"];
        // Add your logic here  
      }
      /**
       * The didShowAdWithTransactionInfo callback will cotanin the transaction information of the ad that produced an impression.  
       */
      - (void)adView:(ASAdView*)adVidew didShowAdWithTransactionInfo:(NSDictionary*)transcationData {
        NSString* buyerName = transcationData[@"buyerName"];
        NSNumber* buyerPrice = transcationData[@"buyerPrice"];
        // Add your logic here
      }
      @end
      		
    • Swift
      class ViewController: UIViewController, ASInterstitialViewControllerDelegate, ASAdViewDelegate {
        var asInterstitialVC: ASInterstitialViewController?
        var asAdView: ASAdView?
        /**
         * When gettings the ad transaction information, no change are needed in how we load the ASInterstitialViewController. We
         * just need to add in the callback.
         */
        func loadInterstitialAd() {
          asInterstitialVC? = ASInterstitialViewController(forPlacementID: "1000741", with: self)
          asInterstitialVC?.loadAd()
        }
        /**
         * When gettings the ad transaction information, no change are needed in how we load the ASAdView. We
         * just need to add in the callback.
         */
        func loadBannerAd() {
          asAdView? = ASAdView(placementID: "1024876" andAdSize: ASBannerSize)
          asAdView?.delegate = self
          view.addSubview(asAdView!)
          asAdView?.loadAd()
        }
        //MARK: AerServ Interstitial Callbacks
        func interstitialViewControllerAdLoadedSuccessfully(_ viewController: ASInterstitialViewController!) {
          asInterstitialVC?.show(from: self)
        }
        /**
         * The didLoadAdWithTransactionInfo callback will contain the transaction information of the ad from the first load attempt. The transaction 
         * information from this callback may be different from the ad the produce the impression.
         */
        func interstitialViewController(_ viewController: ASInterstitialViewController!, didLoadAdWithTransactionInfo transcationData: [AnyHashable : Any]!) {
          let buyerName:String = transcationData?["buyerName"] as! String;
          let buyerPrice:NSNumber = transcationData?["buyerName"] as! NSNumber;
          // Add your logic here
        }
        /**
         * The didShowAdWithTransactionInfo callback will cotanin the transaction information of the ad that produced an impression.  
         */
        func interstitialViewController(_ viewController: ASInterstitialViewController!, didShowAdWithTransactionInfo transcationData: [AnyHashable : Any]!) {
          let buyerName:String = transcationData?["buyerName"] as! String;
          let buyerPrice:NSNumber = transcationData?["buyerName"] as! NSNumber;
          // Add your logic here
        }
        //MARK: Aerserv Banner Callback
        func viewControllerForPresentingModalView() -> UIViewController! {
          return self  
        }
        /**
         * The didLoadAdWithTransactionInfo callback will contain the transaction information of the ad from the first load attempt. The transaction 
         * information from this callback may be different from the ad the produce the impression.
         */ 
        func adView(_ adView: ASAdView!, didLoadAdWithTransactionInfo transcationData: [AnyHashable : Any]!) { 
          let buyerName:String = transcationData?["buyerName"] as! String;
          let buyerPrice:NSNumber = transcationData?["buyerName"] as! NSNumber;
          // Add your logic here
        }
        /**
         * The didShowAdWithTransactionInfo callback will cotanin the transaction information of the ad that produced an impression.  
         */
        func adView(_ adView: ASAdView!, didShowAdWithTransactionInfo transcationData: [AnyHashable : Any]!) { 
          let buyerName:String = transcationData?["buyerName"] as! String;
          let buyerPrice:NSNumber = transcationData?["buyerName"] as! NSNumber;
          // Add your logic here
        }
      }
      		

    The transactionData dictionary object contains keys for "buyerName" and "buyerPrice" that can be accessed for the transaction information values.

    Adding Publisher Keys

    Custom revenue reports can be generated via the SDK by assigning a dictionary object with publisher key value pairs to the pubKeys property. This is available for both interstitials and banners. For details about publisher keys, click here.

    • Objective-C
      #import <InMobiSDK/InMobiSDK.h>
      @interface ViewController() <ASInterstitialViewControllerDelegate, ASAdViewDelegate>
      @property(nonatomic, strong) ASInterstitialViewController* asInterstitialVC;
      @property(nonatomic, strong) ASAdView* asAdView;
      @end
      @implementation ViewController
      /**
       * Before loading an ad with ASInterstitialViewController, you'll need to set the values for pubKeys.
       */
      - (void)loadInterstitialAd {
        self.asInterstitialVC = [ASInterstitialViewController viewControllerForPlacementID:@"1000741" withDelegate:self];
        self.asInterstitialVC.pubKeys = @{@"channel_category":@"music", @"content_rating":@"4 stars"}; // Dictionary containing publisher keys
        [self.asInterstitialVC loadAd];
      }
      /**
       * Before loading an ad with ASAdView, you'll need to set the values for pubKeys.
       */
      - (void)loadBannerAd() {
        self.asAdView = [ASAdView viewWithPlacementID:@"1024876" andAdSize:ASBannerSize];
        self.asAdView.delegate = self;
        self.asAdView.pubKeys = @{@"partner_name":@"bloomberg", @"episode_id":@"77889"}; // Dictionary containing publisher keys
        [self.view addSubview:self.asAdView];
        [self.asAdView loadAd];
      }
      #pragma mark - AerServ Interstitial Callbacks
      - (void)interstitialViewControllerAdLoadedSuccessfully:(ASInterstitialViewController*)viewController {
        [viewController showFromViewController:self];
      }
      #pragma mark - AerServ Banner Callbacks
      - (UIViewController*)viewControllerForPresentingModalView {
        return self;
      }
      @end
      		
    • Swift
      class ViewController: UIViewController, ASInterstitialViewControllerDelegate, ASAdViewDelegate {
        var asInterstitialVC: ASInterstitialViewController?
        var asAdView: ASAdView?
        /**
         * Before loading an ad with ASInterstitialViewController, you'll need to set the values for pubKeys.
         */
        func loadInterstitialAd() {
          asInterstitialVC? = ASInterstitialViewController(forPlacementID: "1000741", with: self)
          asInterstitialVC?.pubKeys = ["channel_category": "music", "content_rating": "4 stars"] // Dictionary containing publisher keys
          asInterstitialVC?.loadAd()
        }
        /**
         * Before loading an ad with ASAdView, you'll need to set the values for pubKeys.
         */
        func loadBannerAd() {
          asAdView? = ASAdView(placementID: "1024876" andAdSize: ASBannerSize)
          asAdView?.delegate = self
          asAdView?.pubKeys = ["partner_name": "bloomberg", "episode_id": "77889"] // Dictionary containing publisher keys.
          view.addSubview(asAdView!)
          asAdView?.loadAd()
        }
        //MARK: AerServ Interstitial Callbacks
        func interstitialViewControllerAdLoadedSuccessfully(_ viewController: ASInterstitialViewController!) {
          asInterstitialVC?.show(from: self)
        }
        //MARK: AerServ Banner Callbacks
        func viewControllerForPresentingModalView() -> UIViewController! {
          return self  
        }
      }
      		

    Note: Publisher Keys can also be used as custom macro on the SSUI. Please contact support on instructions on how to use this feature.

  • Enabling Geolocation Targeting

    If your application already requests permission for geolocation, skip this step. Enabling geolocation will help target ads relevant to your user's physical location. This can be done by adding key-value pairs to your application's Info.plist. The keys will be:

    • NSLocationAlwaysUsageDescription
    • NSLocationWhenInUseUsageDescription

    The value for both will be a string that will be displayed when your application is requesting for geolocation permission.

    <key>NSLocationAlwaysUsageDescription</key> 
    <string>Location is used to help target content to your general area</string>
    <key>NSLocationWhenInUseUsageDescription</key> 
    <string>Location is used to help target content to your general area</string>
    	
  • Disabling App Transport Security for iOS 9 and above

    Select your application's Info.plist, right-click on it and open as source code. Copy the following code into your Info.plist's xml.

    <key>NSAppTransportSecurity</key>
    <dict>
      <key>NSAllowsArbitraryLoads</key><true/>
    </dict>
    	
  • iOS 12 Wifi Settings

    Enable XCode WiFi Settings

    From iOS 12 onwards Apple has introduced privacy settings to access WiFi details. If the publisher decides to share wifi details, they can take advantage of targeted ads. Benefits of ad targeting are that the ads are more useful and meaningful to users.

    How to enable Access Wifi Information?

    1. Enable access WiFi information feature to your App ID.


    2. Enable access WiFi information feature for your target app from XCode capabilities.


    3. WiFi Access should get added to your App.entitlements file. If not please add the following code to your App.entitlements file.
              <dict>
                  <key>com.apple.developer.networking.wifi-info</key>
                  <true/>
              </dict>
      		

    AVAudioSession event changes in WKWebView

    WKWebView ignores AVAudioSessionCategory, Publisher can handle audio interruptions by registering to observe AVAudioSessionInterruptionnotification posted by AVAudioSession. Publisher should ensure minimum possible disruption, and the most graceful possible recovery, from the perspective of the user.

    Observing Audio Interruptions

    To handle audio interruptions, begin by registering to observe notifications of type AVAudioSessionInterruptionNotification.

        - (void)registerForAudioInterruptionNotification {
        AVAudioSession *audioSession = [AVAudioSession sharedInstance];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAudioSessionInterruption:) name:AVAudioSessionInterruptionNotification object:audioSession];
    }
    - (void)handleAudioSessionInterruption:(NSNotification *)notification {
        NSNumber *interruptionType = [[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey];
        NSNumber *interruptionOption = [[notification userInfo] objectForKey:AVAudioSessionInterruptionOptionKey];
        switch (interruptionType.unsignedIntegerValue) {
            case AVAudioSessionInterruptionTypeBegan: {
                /* the system has interrupted your audio session */
                /* Pause, Save State, Update UI */
                break;
            }
            case AVAudioSessionInterruptionTypeEnded: {
                if (interruptionOption && interruptionOption.unsignedIntegerValue == AVAudioSessionInterruptionOptionShouldResume) {
                    /* the interruption has ended */
                    /* Resume, Update State, Update UI */
                }
                break;
            }
        }
    }
    	

    The posted NSNotification instance contains a userInfo dictionary providing the details of the interruption. You can determine the type of interruption by retrieving the AVAudioSessionInterruptionType value from the userInfo dictionary. The interruption type indicates whether the interruption has begun or has ended. If the interruption type is AVAudioSessionInterruptionTypeEnded, the userInfo dictionary might contain an AVAudioSessionInterruptionOptions value.

    An options value of AVAudioSessionInterruptionOptionShouldResume is a hint that indicates whether your app should automatically resume playback if it had been playing when it was interrupted. Media playback apps should always look for this flag before beginning playback after an interruption. If it’s not present, playback should not begin again until initiated by the user. Apps that don’t present a playback interface, such as a game, can ignore this flag and reactivate and resume playback when the interruption ends.

    Please Note: There is no guarantee that a begin interruption will have a corresponding end interruption. Your app needs to be aware of a switch to a foreground running state or the user pressing a Play button. In either case, determine whether your app should reactivate its audio session.

    For more details, please refer to the following:

    1. https://developer.apple.com/documentation/avfoundation/avaudiosession/1616596-interruptionnotification
    2. https://developer.apple.com/library/archive/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/HandlingAudioInterruptions/HandlingAudioInterruptions.html
  • Version History

    SDK 9.0

    • 9.0.2: 11/20/19

      - Update IMAB MoPub Plugin to support MoPub v5.10.0

      - Add SDK support for Xcode 10.2

    • 9.0.1: 10/25/19

      - Upgrade OMSDK to v1.2.19

      - Separate Moat SDK from Inmobi Core SDK

      - Separate OMSDK from Inmobi Core SDK

      - Add CocoaPods for DFP AB plugin

      - Add CocoaPods for MoPub AB plugin

      - GDPR changes, addition of new key "gdpr_consent"

    • 9.0.0: 9/20/19

      - Changes to support iOS 13

      - New and improved Modularised SDK design

      - Add InMobiMediationSDK.framework to your project for AerServ Mediation.

      - Addressing issue with layering of FAN banners upon refresh

      - SKStoreProductViewController crash fix.

      - Removed Support for iOS 8.

      - Removed Support for AerServ Native ad format.

      - Removed UIWebView from InMobi SDK. Viewability Partners might be using it.

      - Size reduction for both Framework and ipa inflation.

      - Various Bug Fixes and performance improvements

      - Adapter updates for the following mediation partners:

      • MoPub - v5.9.0
      • Google Mobile Ads - v7.50.0

      - APIs Added

      • IMBanner Class + -(void)cancel;
      • IMInterstitial Class + -(void)cancel;
      - APIs Added
      • ASAdView Class
        - @property (nonatomic, assign) ASEnvironmentType env;
        - @property (nonatomic, assign) ASPlatformType platform;
        - @property (nonatomic, assign) BOOL isMuted;
        - @property (nonatomic, assign) BOOL outlineAd;
        - @property (nonatomic, assign) BOOL sizeAdToFit;
        - @property (nonatomic, assign) BOOL useHeaderBidding;
        - @property (nonatomic, strong) NSArray* keyWords;
        - @property (nonatomic, assign) BOOL allowAdvertiserCloseButton;
        - -(void)forceRefreshAd;
        - -(CGSize)adContentSize;
        - -(void)rotateToOrientation:(UIInterfaceOrientation)newOrientation;
        - -(void)play;
        - -(void)pause;

      • ASAdViewDelegate Protocol
        - -(void)willLeaveApplicatonFromAd:(ASAdView*)adView;
        - -(void)adSizeChanged:(ASAdView*)adView;
        - -(void)adView:(ASAdView*)adView didFireAdvertiserEventWithMessage:(NSString*)msg;

      • ASInterstitialViewController Class
        - @property (nonatomic, assign) ASEnvironmentType env;
        - @property (nonatomic, assign) ASPlatformType platform;
        - @property (nonatomic, assign) BOOL isMuted;
        - @property (nonatomic, assign) BOOL showOutline;
        - @property (nonatomic, assign) BOOL useHeaderBidding;
        - -(void)play;
        - -(void)pause;
      • ASInterstitialViewControllerDelegate Protocol
        - -(void)interstitialViewControllerAdInteraction:(ASInterstitialViewController*)viewController;
        - -(void)interstitialViewController:(ASInterstitialViewController*)viewController didFireAdvertiserEventWithMessage:(NSString*)msg;
    • 8.2.0: 8/5/19
      • Chrome Custom tabs support
      • Thread Optimizations
      • Bug Fixes for SDK and AudienceBidder Plugin
    • 8.1.2: 7/18/19
      • Size reduction
      • Support for Audience Bidding for DFP
      • New api to set slot size for Banner in Audience Bidding
    • 8.1.1: 6/19/19
      • Updated AdColony SDK support to 3.3.10
      • Updated Audience Network (Facebook) support to 5.3.1
    • 8.1.0: 5/14/19
      • DFP Plugin Support
      • Mopub Audience Bidding Plugin Keyword Handling
      • Bug fixes
    • 8.0.8: 4/17/19
      • Bug Fixes
    • 8.0.7: 4/05/19
      • Additional support for higher granularity keywords
    • 8.0.5: 3/11/19
      • Audience Bidder for the Mopub Plugin
      • Telaria Adapter Deprecation
      • Flurry Banner Adapter Deprecation
      • Applovin 3rd Party API Reporting updates
      • Chartboost 3rd Party API Reporting updates
      • Mediated SDK updates
      • Bug Fixes
    • 8.0.2: 12/13/18
      • Mediation bug Fixes
    • 8.0.1: 11/28/18
      • Unified InMobi + AerServ SDK

    exchange | Android

    Prerequisites

    • The latest version of InMobi Mediation SDK supports Android 4.2.2 (Jelly Bean, API 17) and higher. Additionally, MRAID ads require API 19 and higher.
      Note: Older Android versions may work but are not officially supported.
    • Google Play Services will adhere to the user’s ad tracking preferences. For more information, please see Google's website regarding their Advertising ID.
    • We recommend to call all InMobi Mediation APIs on UiThread.

    Now that you have ensured these requirements, let's look at some checkpoints before we integrate the SDK:

    Checkpoint 1: Preparing Your App for Android 10

    InMobi SDK is compatible with Android 10 (API level 29), the latest version of the Android platform. On Android P onwards, apps make connections over HTTPS by default. Though InMobi supports the adoption of HTTPS, the current setup requires our demand partners to support HTTPS as well. The publisher can change their settings to HTTP if it has an impact on the revenue potential.

    Checkpoint 2: Preparing Your App for AndroidX

    InMobi SDK is compatible with AndroidX (JetPack) library. In case your app uses the AndroidX library, then 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.

    Step 1: Integrating the SDK

    • Step 1.1: Adding the InMobi SDK to your Project

      Option 1: Pulling the Latest SDK via JCenter

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

      1. Include JCenter in your top-level build.gradle file:
        allprojects {
            repositories {
                jcenter()
            }
        }
        			
      2. Add the following line to the dependencies element in your application module’s build.gradle file.
        implementation 'com.inmobi.monetization:inmobi-ads:9.0.4'
        implementation 'com.inmobi.monetization:inmobi-mediation:9.0.4'
        			
      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

      Alternately, 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'])
      		
    • Step 1.2: Adding and Verifying the Dependencies

      To monetize with the InMobi Mediation SDK, you must add the following dependencies to your app module build.gradle. For more information on why each dependency is required, see below:

      android {
        defaultConfig { 
        }
        buildTypes {
          ...
        }
        sourceSets {
          main {
          }
        }
      }
      repositories {
        ...
      }
      dependencies {
      	implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
      	implementation 'com.google.android.gms:play-services-location:17.0.0' //optional dependency for better targeting
      	implementation 'com.android.support:customtabs:28.0.0'
      	implementation 'com.squareup.picasso:picasso:2.71828'
      	implementation 'com.android.support:support-v4:28.0.0'
      	implementation 'com.android.support:recyclerview-v7:28.0.0'
      }
      		
        • 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.0.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 'com.android.support:customtabs:28.0.0'
            					
          2. Sync your Gradle project to ensure dependencies are included.

          Note: 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.

        Note: 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 do so, 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 use RecyclerView.

        To do so, add the following line to the application module’s dependency element in the Gradle build script.

        implementation 'com.android.support:recyclerview-v7:28.0.0'
        			

        Note: 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 {
                      applicationId "com.inmobi.samples"
                      minSdkVersion 15
                      targetSdkVersion 29 
                      versionCode 1
                      versionName "1.0.0"
                      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 'com.android.support:multidex:1.0.3'
          				
    • Note: Now that you have added the dependencies, your app's build.gradle at this point will look like as shown below:

    • Step 1.2a: 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"
          ...
      >
      		
    • Step 1.3: 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.**
      		
    • Step 1.4: Android Manifest

      • Add the following Android permission and activities into your Android Manifest:
        <?xml version='1.0' encoding='utf-8'?>
        <manifest xmlns:android='http://schemas.android.com/apk/res/android' package='com.sample.myapp' >
        <!-- Optional Permissions -->
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <application
        android:allowBackup='true'
        android:label='@string/app_name'>
        </application>
        </manifest>
        			

        Note: Not including the optional permission MAY negatively impact fill for the respective networks that use these permissions.

    Step 2: Initialize the SDK

    • You must initialize SDK before loading any ads.We recommend that you invoke the initialization routine and wait for the completion callback before you intend to show your first ad. We suggest you initialize the SDK during the onCreate() state within your main activity. Failure in the initialization of SDK will cause every ad request to timeout as initialization is mandatory.
    • To initialize the SDK, invoke AerServSdk.init(activity<Activity>, siteId<String>, gdprConsentObject<JSONObject>, sdkInitializatonListener<SdkInitializationListener>) on the AerServSdk class.
    • To set or update the General Data Protection Regulation (GDPR) user consent flag, you can either call AerServSDK’s setGdprConsent method or pass it through the initialization method.

      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.
    /**
    * Start "pre-init". Returns error object with an appropriate message when SDK was
    * not successfully initialized, otherwise null.
    *
    * @param context  Context
    * @param siteId   AerServ's "siteID" or "appId"
    * @param listener Represents a listener object to provide callback when SDK initialization
    *                 process is complete
    */
    public static void init(@NonNull final Context context,
                            @NonNull final String siteId,
                            @Nullable SdkInitializationListener listener)
    /**
    * Start "pre-init". Returns error object with an appropriate message when SDK was
    * not successfully initialized, otherwise null
    *
    * @param context           Context
    * @param siteId            AerServ's "siteID" or "appId"
    * @param gdprConsentObject User consent for GDPR
    * @param listener          Represents a listener object to provide callback when SDK
    *                          initialization process is complete
    */
    public static void init(@NonNull final Context context,
                            @NonNull final String siteId,
                            @Nullable final JSONObject gdprConsentObject,
                            @Nullable final SdkInitializationListener listener)
    /**
    * Set the flag for user consent.
    *
    * @param gdprConsentObject Users' consent for GDPR.
    */
    public static void setGdprConsent(@Nullable JSONObject gdprConsentObject);
    /**
     * Returns the consent flag for GDPR
     * @param context Context. This is left in for legacy reason. Pre-unification, the AS stored the
     *                consentFlag inside the SharedPreferences. This meant we needed the context. At
     *                the same time, we don't want to remove this parameter for publisher already
     *                integrated with the older API.
     * @return Returns the flag for user consent in GDPR
     */
    @Nullable
    public static Boolean getGdprConsentFlag(@NonNull Context context);
    	

    How to obtain the app ID:

    • Log in to the AerServ + InMobi platform.
    • Go to the 'Inventory' tab in the top navigation bar.
    • Click the 'Edit' icon next to the app whose ID you wish to obtain.
    • You will find the app ID at the very top of the page.

    Mediation Disclaimer: Please be advised that although we are GDPR compliant, we currently have no way to send GDPR compliance as well as user consent to our mediated SDK partners. Compliance responsibility and request handling will solely depend on the SDK mediated partner. Please contact your mediated partners to avoid any issues and/or complications.

    Step 3: Displaying Banner Ads

    • Create an instance of the AerServBanner object. One way of doing this is to define it in your Activity's layout file, e.g. activity_main.xml. The following example will create a 320x50 banner within the MainActivity:
      <com.aerserv.sdk.AerServBanner
          android:id='@+id/banner'
          android:layout_width='320dp'
          android:layout_height='50dp'/>
      		
    • In your code, obtain a reference to the AerServBanner instance and use it to call configure() and show().
      package com.sample.myapp;
      import android.app.Activity;
      import android.os.Bundle;
      import com.aerserv.sdk.AerServBanner;
      import com.aerserv.sdk.AerServConfig;
      import com.aerserv.sdk.AerServSdk;
      public class MainActivity extends Activity {
        private static final String APP_ID = "1000473";
        private static final String PLACEMENT_ID = "1024876";
        @Override
        public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                  @Override
                  public void onInitializationComplete(@Nullable Error error) {
                      if (null != error) {
                          Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                      } else {
                          Log.d(TAG, "AerServ Init Successful");
                      }
                  }
              });
        }
        /**
         * The banner doesn't need to be loaded in the main activity. However, the context that's passed 
         * in must also be a activity context. 
         */
        public void loadBannerAd() {
          AerServConfig config = new AerServConfig(this, PLACEMENT_ID);
          /**
           * After finding the view, you'll have to typecast the view into a AerServBanner object;
           */
          banner = (AerServBanner) findViewById(R.id.banner);
          /**
           * If you are not preloading, you MUST call show right after configure is called. Failing to do
           * so will result in unintended behavior.
           */
          banner.configure(config).show();
        }
      }
      		
    • Alternatively, you can also create the AerServ Banner instance programmatically.
      package com.sample.myapp;
      import android.app.Activity;
      import android.content.res.Resources;
      import android.os.Bundle;
      import android.util.TypedValue;
      import android.view.ViewGroup;
      import android.widget.RelativeLayout;
      import com.aerserv.sdk.AerServBanner;
      import com.aerserv.sdk.AerServConfig;
      public class MainActivity extends Acitvity {
        private static final String APP_ID = "1000473";
        private static final String PLACEMENT_ID = "1024876";
        private AerServBanner banner;
        @Override
        public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                  @Override
                  public void onInitializationComplete(@Nullable Error error) {
                      if (null != error) {
                          Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                      } else {
                          Log.d(TAG, "AerServ Init Successful");
                      }
                  }
              });
        }
        /**
        * AerServBanner is a subclass of the RelativeLayout class and can be modify as such. 
        * (e.g.RelativeLayout.setLayoutParams to change the width and height of the view)
        */
        public void loadBannerAd() {
          AerServConfig config = new AerServConfig(this, PLACEMENT_ID);
          banner = new AerServBanner(this);
          /**
           * Setting the height and width of the banner. This was previously done in the xml.
           */
          Resources r = getResources();
          float width = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 320, r.getDisplayMetrics());
          float height = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, r.getDisplayMetrics());
          banner.setLayoutParams(new RelativeLayout.LayoutParams(Math.round(width), Math.round(height)));
          /**
           * Add the banner as a child view. You MUST add the view into the UI before calling configure 
           * and show. In this example, we'll be adding it to the root view group.
           */
          ((ViewGroup) findViewById(android.R.id.content)).addView(banner);
          banner.configure(config).show();
        }
      }
      		

      If you’d like your app to listen to ad events and know when an ad has loaded or failed, implement an AerServEventListener and add it to your AerServConfig object:

      package com.sample.myapp;
      import android.app.Activity;
      import android.os.Bundle;
      import android.util.Log;
      import java.util.List;
      import com.aerserv.sdk.AerServBanner;
      import com.aerserv.sdk.AerServConfig;
      import com.aerserv.sdk.AerServEvent;
      import com.aerserv.sdk.AerServEventListener;
      import com.aerserv.sdk.AerServSdk;
      public class MainActivity extends Acitivity {
        private static final String APP_ID = "1000473";
        private static final String PLACEMENT_ID = "1024876";
        @Override
        public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                  @Override
                  public void onInitializationComplete(@Nullable Error error) {
                      if (null != error) {
                          Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                      } else {
                          Log.d(TAG, "AerServ Init Successful");
                      }
                  }
              });
        }
        public void loadBannerAd() {
          AerServEventListener listener = new AerServEventListener() {
            @Override
            public void onAerServEvent(AerServEvent event, List params) {
              switch (event) {
                case AD_LOADED:
                  // Execute some code when AD_LOADED event occurs.
                  break;
                case AD_DISMISSED:
                  // Execute some code when AD_DISMISSED event occurs.
                  break;
                case AD_FAILED:
                  // Execute some code when AD_FAILED event occurs.
                  break;
              }
            }
          };
          AerServConfig config = new AerServConfig(this, PLACEMENT_ID);
          /**
          * You'll have to pass the AerServEventListener through the the AerServConfig.
          */
          config.setEventListener(listener); 
          AerServbanner banner = (AerServBanner) findViewById(R.id.banner);
          banner.configure(config).show();
        }
      }
      		

    For additional events, please see Additional Settings section.

    • You should pause your banner when your app is backgrounded, and play it when the app resumes. You can also kill a banner.

      The methods are:

      package com.sample.myapp;
      import android.app.Activity;
      import android.os.Bundle;
      import com.aerserv.sdk.AerServBanner;
      import com.aerserv.sdk.AerServConfig;
      import com.aerserv.sdk.AerServSdk;
      public class MainActivity extends Activity {
        private static final String APP_ID = "1000473";
        private static final String PLACEMENT_ID = "1024876";
        private AerServBanner banner = null;
        @Override
        public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                  @Override
                  public void onInitializationComplete(@Nullable Error error) {
                      if (null != error) {
                          Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                      } else {
                          Log.d(TAG, "AerServ Init Successful");
                      }
                  }
              });
        }
        /**
         * You will want to call pause when the banner goes out of view. One example of this occurring is 
         * when the activity goes into the pause state, it prevents the banner from refreshing in the 
         * background. This will occur when you switch the intent to another activity or when the
         * application goes into the background.
         */
        @Override
        public void onPause() {
          if(banner != null) {
            banner.pause();
          }
        }
        /**
         * Once the activity resumes and the banner is in view again, you can resume the banner refresh.
         */
        @Override
        public void onResume() {
          if(banner != null) {
            banner.play();
          }
        }
        /**
         * Once the activity is about to be destroyed, you'll want to call kill on the banner object to 
         * to ensure that all resources is cleaned.
         */
        @Override
        public void onDestroy() {
          if(banner != null) {
            banner.kill();
          }
        }
        public void loadBannerAd() {
          // The PLC 1024876 is for testing only and returns a 320x50 static HTML banner
          AerServConfig config = new AerServConfig(this, PLACEMENT_ID);
          AerServBanner banner = (AerServBanner) findViewById(R.id.banner);
          banner.configure(config).show();
        }
      }
      		
    • Pausing a banner will prevent it from refreshing, and killing it will remove it from the view.

    Step 4: Display Interstitial Ads

    You can configure and show a test interstitial ad in your Activity, as follows:

    package com.sample.myapp;
    import android.app.Activity;
    import android.os.Bundle;
    import com.aerserv.sdk.AerServSdk;
    import com.aerserv.sdk.AerServConfig;
    import com.aerserv.sdk.AerServInterstitial;
    public class MainActivity extends Activity {
      private static final String APP_ID = "1000473";
      private static final String PLACEMENT_ID = "1000741";
      @Override
      public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                @Override
                public void onInitializationComplete(@Nullable Error error) {
                    if (null != error) {
                        Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                    } else {
                        Log.d(TAG, "AerServ Init Successful");
                    }
                }
            });
      }
      public void loadInterstitialAd() {
          AerServConfig config = new AerServConfig(this, PLACEMENT_ID); 
          AerServInterstitial interstitial = new AerServInterstitial(config); 
          interstitial.show();
      }
    ]
    	

    If you’d like your app to listen to ad events and know when an ad has loaded or failed, implement an AerServEventListener and add it to your AerServConfig object:

    package com.sample.myapp;
    import android.app.Activity;
    import android.os.Bundle;
    import android.util.Log;
    import java.util.List;
    import com.aerserv.sdk.AerServConfig;
    import com.aerserv.sdk.AerServEvent;
    import com.aerserv.sdk.AerServEventListener;
    import com.aerserv.sdk.AerServInterstitial;
    import com.aerserv.sdk.AerServSdk;
    public class MainActivity extends Acitivity {
      private static final String APP_ID = "1000473";
      private static final String PLACEMENT_ID = "1000741";
      @Override
      public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                @Override
                public void onInitializationComplete(@Nullable Error error) {
                    if (null != error) {
                        Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                    } else {
                        Log.d(TAG, "AerServ Init Successful");
                    }
                }
            });
      }
      public void loadInterstitialAd() {
        AerServEventListener listener = new AerServEventListener() {
          @Override
          public void onAerServEvent(AerServEvent event, List params) {
            switch (event) {
              case AD_LOADED:
                // Execute some code when AD_LOADED event occurs.
                break;
              case AD_DISMISSED:
                // Execute some code when AD_DISMISSED event occurs.
                break;
              case AD_FAILED:
                // Execute some code when AD_FAILED event occurs.
                break;
            }
          }
        };
        AerServConfig config = new AerServConfig(this, PLACEMENT_ID);
        /**
         * You'll have to pass the AerServEventListener through the the AerServConfig.
         */
        config.setEventListener(listener); 
        AerServInterstitial interstitial = new AerServInterstitial(config); 
        interstitial.show();
      }
    }
    	
  • For additional events, please see Additional Settings section.
  • Preloading will start the process of fetching an ad and caching the video. It also informs the app earlier whether it will get an ad. We highly recommend that you use this feature whenever possible.

    To preload an interstitial ad, the steps are:

    1. Create an AerServEventListener listener and listen to the PRELOAD_READY event. When the event is fired, the ad is successfully preloaded.
    2. Create an AerServConfig object, and set the above AerServEventListener as listener. Set preload flag to true in above AerServConfig object.
    3. Instantiate an AerServInterstitial object, which will start the preload process. Do NOT call show() yet, as the ad is still being loaded. When you are ready to show the ad, call show(). You must only call show after you have received PRELOAD_READY event in step 1 above.

    Here is the code snippet for the above steps:

    package com.sample.myapp;
    import android.app.Activity;
    import android.os.Bundle;
    import android.util.Log;
    import java.util.List;
    import com.aerserv.sdk.AerServConfig;
    import com.aerserv.sdk.AerServEvent;
    import com.aerserv.sdk.AerServEventListener;
    import com.aerserv.sdk.AerServInterstitial;
    import com.aerserv.sdk.AerServSdk;
    public class MainActivity extends Activity {
      private static final String APP_ID = "1000473";
      private static final String PLACEMENT_ID = "1000741";
      private AerServInterstitial interstitial = null;
      private bool isAdLoaded = false; 
      @Override
      public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                @Override
                public void onInitializationComplete(@Nullable Error error) {
                    if (null != error) {
                        Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                    } else {
                        Log.d(TAG, "AerServ Init Successful");
                    }
                }
            });
      }
      /**
       * We check if the preload flag has been previously set. This is so that we don't waste an ad that 
       * has already been preloaded and calling another load won't necessary fill.
       */
      public void loadInterstitialAd() {
          if(isAdLoaded == false) {
            AerServEventListener listener = new AerServEventListener() {
              @Override
              public void onAerServEvent(AerServEvent event, List params) {
                switch (event) {
                  case PRELOAD_READY:
                    MainActivity.this.isAdLoaded = true;
                    // Anywhere after this point you can call showInterstitial();
                    break;
                  case AD_DISMISSED:
                    MainActivity.this.isAdLoaded = false;
                    Log.v(MainActivity.class.getSimpleName(), "Interstitial was shown.");
                    break;
                  case AD_FAILED:
                    MainActivity.this.isAdLoaded = false;
                    Log.v(MainActivity.class.getSimpleName(), "Interstitial failed to load.");
                    break;
                }
              }
            };
            AerServConfig config = new AerServConfig(this, PLACEMENT_ID)
              .setEventListener(listener)
              .setPreload(true); // This flag needs to be set for preload to work correctly.
            interstitial = new AerServInterstitial(config);
          } else {
            Log.v(MainActivity.class.getSimpleName(), "Interstitial has already been loaded");
          }
      }
      public void showInterstitial() {
        if(interstitial != null && isAdLoaded) {
          interstitial.show();
        } else {
          Log.v(MainActivity.class.getSimpleName(), "Interstitial has not been loaded");
        }
      }
    }
    	
  • Step 5: Additional Settings

    • Complete List of Events

      • Our SDK fires these additional AerServEvent events that can be caught by AerServEventListener:
      EVENT CALLBACK ENUM PURPOSE
      AD_CLICKED Ad was clicked or touched
      AD_COMPLETED Ad has completed
      AD_DISMISSED Ad has been closed
      AD_FAILED Ad failed to load
      AD_IMPRESSION Ad has shown
      LOAD_TRANSACTION This event will return a BuyerName as well as a BuyerPrice for the loaded ad.
      AD_LOADED Ad has been loaded
      PRELOAD_READY Ad has been preloaded
      VC_READY This event communicates the Virtual Currency (VC) name, amount, buyer name, and buyer price of the loaded ad. Please note that it does not imply the ad is preloaded nor does it imply that VC is rewarded. For those, you need to listen to PRELOAD_READY and VC_REWARDED events, respectively.
      VC_REWARDED Virtual Currency was rewarded
      VIDEO_COMPLETED Video has completed
      VIDEO_START Video ad has started
      SHOW_TRANSACTION This event communicates the Transaction Information of the loaded ad. This includes the buyer name and buyer price.
    • Virtual Currency

      • Virtual Currency (VC) allows you to reward users based on completed video views. You can configure the VC name and amount on SSUI, and the SDK will inform your app via events when the user has fully watched a video.
      • Here is the code example of how to listen to VC events:
        package com.sample.myapp;
        import android.app.Activity;
        import android.os.Bundle;
        import android.util.Log;
        import java.utils.List;
        import com.aerserv.sdk.AerServConfig;
        import com.aerserv.sdk.AerServEvents;
        import com.aerserv.sdk.AerServEventListener;
        import com.aerserv.sdk.AerServInterstitial;
        import com.aerserv.sdk.AerServVirtualCurrency;
        public class MainActivity extends Activity {
          private static final String APP_ID = "1000473";
          private static final String PLACEMENT_ID = "1000741";
          @Override
          public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                    @Override
                    public void onInitializationComplete(@Nullable Error error) {
                        if (null != error) {
                            Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                        } else {
                            Log.d(TAG, "AerServ Init Successful");
                        }
                    }
                });
          }
          public loadInterstitialAd() {
            AerServEventListener listener = new AerServEventListener() {
              @Override
              public void onAerServEvent(AerServEvent event, List params) {
                switch (event) {
                  /**
                   * The VC_READY event will notify when we load the creative. Note that you can also get 
                   * the buyerName and buyer price throught the LOAD_TRANSACTION and SHOW_TRANSACTION event.
                   */
                  case VC_READY:
                    AerServVirtualCurrency vc = (AerServVirtualCurrency) params.get(0);
                    String name = vc.getName();
                    BigDecimal amount = vc.getAmount();
                    String buyerName = vc.getBuyerName();
                    BigDecimal buyerPrice = vc.getBuyerPrice();
                    // Add your logic here  
                    break;
                  /**
                   * The second callback will notify when the virtual currency has been rewarded. This will 
                   * only fire after the user has watch 100% of the video on a virtual currency enable 
                   * placement.
                   */
                  case VC_REWARDED:
                    AerServVirtualCurrency vc = (AerServVirtualCurrency) params.get(0);
                    String name = vc.getName();
                    BigDecimal amount = vc.getAmount();
                    String buyerName = vc.getBuyerName();
                    BigDecimal buyerPrice = vc.getBuyerPrice();
                    // Add your logic here  
                    break;
                }
              }
            };
            /**
             * Nothing change when using either of these AerServEvent. Both VC_READY and VC_REWARDED will 
             * work with banners and interstitial integration. 
             */
            AerServConfig config = new AerServConfig(this, PLACEMENT_ID)
              .setEventListener(listener)
            AerServInterstitial interstitial = new AerServInterstitial(config);
            interstitial.show();
          }
        }
        			

        Note: The buyer name and buyer price can be null, so if you intend to use those objects, make sure you check for a null value.

        • Use AerServConfig object to set user ID:
          String USER_ID = "MyUserId";
          String PLACEMENT_ID = "1000741";
          AerServConfig config = new AerServConfig(MainActivity.this, PLACEMENT_ID).setUserId(USER_ID);
          				
        • We also support server VC callbacks. To use this feature please see the How to Set Up Rewarded Currency (Virtual Currency).The userId is required for VC enabled placements to be used on the server VC callback and for frequency capping.

          The userId is required for VC enabled placements to be used on the server VC callback and for frequency capping.

      • Ad Transaction Information

        During the process of showing an ad, the InMobi SDK will additionally return information pertaining to the buyer for your ad space and the price that the ad space was bought for.

        This detailed information can be found from these events:

        package com.sample.myapp;
        import android.app.Activity;
        import android.os.Bundle;
        import java.util.List;
        import com.aerserv.sdk.AerServConfig;
        import com.aerserv.sdk.AerServEvent;
        import com.aerserv.sdk.AerServEventListener;
        import com.aerserv.sdk.AerServInterstitial;
        import com.aerserv.sdk.AerServSdk;
        import com.aerserv.sdk.AerServTransactionInformation;
        public class MainActivity extend Activity {
          private static final String APP_ID = "1000473";
          private static final String PLACEMENT_ID = "1000741";
          @Override
          public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                    @Override
                    public void onInitializationComplete(@Nullable Error error) {
                        if (null != error) {
                            Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                        } else {
                            Log.d(TAG, "AerServ Init Successful");
                        }
                    }
                });
          }
          public void loadInterstitialAd() {
            AerServEventListener listener = new AerServEventListener() {
              @Override
              public void onAerServEvent(AerServEvent event, List params) {
                switch (event) {
                  /**
                   * The LOAD_TRANSACTION event will contain the transaction information of the ad from the 
                   * first load attempt. The transaction information from this callback may be different 
                   * from the ad the produce the impression.
                   */
                  case LOAD_TRANSACTION:
                      AerServTransactionInformation vc = (AerServTransactionInformation) params.get(0);
                      String buyerName = vc.getBuyerName();
                      BigDecimal buyerPrice = vc.getBuyerPrice();
                      // Add your logic here  
                      break;
                  /**
                   * The didShowAdWithTransactionInfo callback will cotanin the transaction information of 
                   * the ad that produced a impression.  
                   */
                  case SHOW_TRANSACTION:
                      AerServTransactionInformation vc = (AerServTransactionInformation) params.get(0);
                      String buyerName = vc.getBuyerName();
                      BigDecimal buyerPrice = vc.getBuyerPrice();
                      // Add your logic here  
                      break;
                }
              }
            };
            /**
             * Nothing change with this implementation. Both LOAD_TRANSACTION and SHOW_TRANSACTION will work
             * with banners and interstitial integration. 
             */
            AerServConfig config = new AerServConfig(this, PLACEMENT_ID)
              .setEventListener(listener)
            AerServInterstitial interstitial = new AerServInterstitial(config);
            interstitial.show();
          }
        }
        			
      • Adding Publisher Keys

        Custom revenue reports can be generated via the SDK by assigning a dictionary object with publisher key value pairs to the pubKeys property. This is available for both interstitials and banners.

        package com.sample.myapp;
        import android.app.Activity;
        import android.os.Bundle;
        import java.util.HashMap;
        import java.util.Map;
        import com.aerserv.sdk.AerServConfig;
        import com.aerserv.sdk.AerServInterstitial;
        import com.aerserv.sdk.AerServSdk;
        public class MainActivity extends Activity {
          private static final String APP_ID = "1000473";
          private static final String PLACEMENT_ID = "1000741";
          @Override
          public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                    @Override
                    public void onInitializationComplete(@Nullable Error error) {
                        if (null != error) {
                            Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                        } else {
                            Log.d(TAG, "AerServ Init Successful");
                        }
                    }
                });
          }
          public void loadInterstitialAd() {
            Map<String, String> pubkeys = new HashMap();
            pubkeys.put("key", "value");
            AerServConfig config = new AerServConfig(this, PLACEMENT_ID)
                    .setPubKeys(pubkeys); // Pass in the Map object.
            interstitial = new AerServInterstitial(config);
            interstitial.show();
          }
        }
        			

        For details about publisher keys, click here.

      • Enabling the Back Button(not supported in InMobi SDK 8.0.1)

        Enable the back button for interstitial. When the user clicks on the back button, the interstitial will exit. This is similar to when skip is enabled on the AerServ + InMobi dashboard. This will only work for ads coming from AerMarket, S2S or tags. By default, the backbutton is only enabled when the a becomes skippable.

        package com.sample.myapp;
        import android.app.Activity;
        import android.os.Bundle;
        import com.aerserv.sdk.AerServConfig;
        import com.aerserv.sdk.AerServInterstitial;
        import com.aerserv.sdk.AerServSdk;
        public class MainActivity extends Activity {
          private static final String APP_ID = "1000473";
          private static final String PLACEMENT_ID = "1000741";
          @Override
          public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            AerServSdk.init(this, APP_ID,new SdkInitializationListener() {
                    @Override
                    public void onInitializationComplete(@Nullable Error error) {
                        if (null != error) {
                            Log.e(TAG, "AerServ Init Failed with error message: " + error.getMessage());
                        } else {
                            Log.d(TAG, "AerServ Init Successful");
                        }
                    }
                });
          }
          public void loadInterstitialAd() {
            AerServConfig config = new AerServConfig(this, PLACEMENT_ID)
            config
              /**
                * This will enable the back button when a interstitial is shown. This will do nothing 
                * when passed into a banner. This will also only work for ads coming form AerMarket, 
                * S2S and tags. By default, the back button is only enabled when skippability is
                * enabled.
                */
              .enableBackButton(true)
              /**
                * As previously stated, the back button is only enabled when skippability is enabled.
                * This is set through the AerServ + InMobi dashboard. You can also override the time for when
                * the back button is enabled.
                */
              .setBackButtonTimeout(5000);
            interstitial = new AerServInterstitial(config);
            interstitial.show();
          }
        }
        			
      • Header Bidding Requests

        The Header Bidding flag is now enabled by default, and "useHeaderBidding" has been deprecated and is no longer needed.

    Version History


      9.0.4: 3/3/20
    • 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)


      9.0.2: 01/27/20
    • 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

        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)


      9.0.1: 10/25/19
    • 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

      9.0.0: 9/20/19
    • 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
    • 8.2.1: 8/22/19
      • Bug Fixes for SDK and AudienceBidder Plugin
    • 8.2.0: 8/5/19
      • Chrome Custom tabs support
      • Thread Optimizations
      • Bug Fixes for SDK and AudienceBidder Plugin
    • 8.1.3: 7/18/19
      • Support for Audience Bidding for DFP
      • Bug Fixes
    • 8.1.2: 6/19/19
      • Updated AdColony SDK support to 3.3.10
      • Updated Audience Network (Facebook) support to 5.3.1
    • 8.1.1: 5/27/19
      • Support for new Picasso version 2.71828
      • Bug Fixes
    • 8.1.0: 5/14/19
      • DFP Plugin Support
      • Mopub Audience Bidding Plugin Keyword Handling
    • 8.0.9: 4/22/19
      • Bug Fixes
    • 8.0.8: 4/17/19
      • Bug Fixes
    • 8.0.7: 4/5/19
      • Bug Fixes
      • Updated AudienceBidder to v1.0.1
        • Support for granular keywords
        • Fixed issue with updateBid not working with MoPub's refresh
        • Replaced source file with a aar
        • Various API Changes (see documentation)
    • 8.0.5: 3/11/19
      • Audience Bidder for the Mopub Plugin
      • Telaria Adapter Deprecation
      • Flurry Banner Adapter Deprecation
      • Applovin 3rd Party API Reporting updates
      • Chartboost 3rd Party API Reporting updates
      • Mediated SDK updates
      • Bug Fixes
    • 8.0.1: 11/28/18
      • Unified InMobi + AerServ SDK

    exchange | Frequently Asked Questions

    Are you new to monetization ? To help you learn more about how InMobi works, we've put together these FAQs from publishers for your reference. If you do not find what you are looking for here or need further assistance, please contact your dedicated InMobi account manager or email us at sales@inmobi.com.

    But before we begin, let’s get a few things out of the way:

    • If you wish to download our latest SDK, please visit the Download SDK page.
    • If you have downloaded the SDK and wish to get started, then please visit the Getting Started page.

    Now that you know where to begin, let’s get to the questions.

    1. Integrating the SDK

    2. Creating Account

    3. Creating Placements

    4. Mediating InMobi

    5. Reporting

    6. Payment

    7. Compliance Guidelines

    exchange | Integrating InMobi with Mediation DRAFT

    Integrating InMobi with Mediation

    This guide is intended for publishers who want to integrate InMobi as a demand source on third party mediation platforms like Mopub, Google, Ironsource, Max, etc. You can integrate Banner, Interstitial, Native and Video ad formats (supported by InMobi) on the below mediation platforms.

    If you instead wish to use the InMobi mediation platform, then we would recommend getting started here.

    Prerequisites

    Download InMobi SDK here and get started with an InMobi account here.

    Mediation Platforms Supported

    Mediation Platform Mediation SDK Version Supported InMobi SDK & Adapters Integration Documentation
    MoPub
    • iOS 5.9.0
    • Android 5.8.0
    InMobi SDK 900

    InMobi SDK 900 Download Adapter: iOS | Android

    Visit
    Google AdMob
    • iOS 7.50.0
    • Android 18.2.0

    InMobi SDK 900 Download Adapter: iOS | Android

    Visit
    Google (Open Bidding)
    • iOS 7.50.0
    • Android 18.2.0

    InMobi SDK 7.3.0: Download Adapter

    Visit
    ironSource
    • iOS 6.8.5.0
    • Android 4.3.1

    InMobi SDK 7.2.1: Download Adapter

    Visit
    Applovin/Max Contact Applovin

    Contact Applovin

    Visit
    Appodeal
    • iOS 2.5.10
    • Android 2.5.8

    InMobi SDK 7.2.7: Download Adapter

    Visit
    Fyber
    • iOS 8.21.0
    • Android 9.56.0

    InMobi SDK 7.1.1: Download Adapter

    Visit

    We would highly recommend following the partner integration guidelines to know more about the specific mediation partner or adding InMobi as a demand source and setting up placements for mediation.

    exchange | Audience Bidding (Header Bidding)

    Audience Bidding is InMobi’s In-app Header Bidding solution. You can leverage unique audience intelligence to pre-fetch audience-driven bids from 70+ DSPs with a single call to our in-app header bidding SDK.

    Important:
    1. If you wish to get started with Audience Bidding, then begin by downloading our Mediation/Header Bidding SDK for iOS and Android.
    2. To create an account or set up placements, visit https://www.inmobi.com/user/index?productId=1#signup

    Audience Bidding works hand-in-hand with your existing mediation platform. The following guides will help you get started with:

    Here's how Audience Bidding will help you:

    1. Revenue Optimization:

      Boost in-app revenue with dynamic bids optimized for each user.
      Maximize fills and revenue by increasing inventory exposure through simultaneous requests to 70+ DSPs that have global access to high intent advertisers.

    2. Enriched Supply:

      Secure your in-app revenue by differentiating your supply path.
      Stand out as enriched supply in a crowded marketplace by augmenting your inventory with high quality audience signals while working directly with the industry’s most preferred demand partners.

    3. Optimized Trafficking:

      Optimize your demand partnerships with smart bids across price points.
      Challenge your existing waterfall with pre-fetched bids across price points with a single SDK call. Get the most optimal bid through unified auctions.

    exchange | test for ios dfp

    Prerequisites

    Step 1: Integrating the SDK

    • Step 1.1: Download the InMobi SDK

      • Warning: Please remove all older versions of the InMobi SDK (7.X.X and older) and all older versions of the AerServ SDK. Otherwise, your code will not compile! Please reach out to your account manager if you have any questions. If you are using CocoaPods, be sure to remove the 'aerserv-ios-sdk' pod from your podfile and only use the 'inmobi-ios-sdk' pod.
    • Step 1.2: Add the Required Libraries

      • Add the following frameworks into your project from the InMobi SDK download:
      • Add the following folders into your project from the InMobi SDK download:
      • Note: When using any mediation through the InMobi SDK, it is highly recommended that you use the framework that is provided along with the InMobi SDK download. These versions have been tested by our team and using any other version may not be officially supported.
    • Step 1.3: General Settings

      • Under the General tab within your project's target, you'll need to add the follow settings:
        • Select all Device Orientation inside 'Deployment Info'.
        • Add the following dependencies to Linked Frameworks and Libraries:
        One or more of the mediation adapters that you selected requires these frameworks. For the SDKs to work properly, you MUST includes these frameworks into your project.
    • Step 1.4: Create a bridging header (Swift Only)

      • You will need to create a bridging header if your application is built with Swift. The bridging header exposes the Objective-C implementation to Swift. To create the bridging header, you'll need to do the following:
        1. Create a new header file, InMobiSDK-Bridging-Header.h.
        2. Add the following entry to the Bridging Header:
          
          
          #import <InMobiSDK/InMobiSDK.h>
        3. Add the newly created header file's path to the target's Build Setting -> Linking -> Objective-C Bridging Header
    • Step 1.5: Build Settings

      • Add the following to the target's Build Setting -> Linking -> Other Flag:
    • Step 1.6: Info.plist

      • You will need to add the following entries into your info.plist:
        
        

        For iOS 9+, you will need to disable App Transport Security (ATS). Please refer here for more detail.
    • Step 1.7: Integrating DFP to InMobi Adapter

      Step 1.7.1 Non-Audience Bidding

      Perform the following steps to initiate non-Audience bidding:

      1.7.1.1 Add DFP to InMobi Adapter

      Add the following files from dist/network-support/Google/DFP-CustomEvents/ to your project.

      1.7.1.2 Configure Ad Setup on DFP Dashboard

      Enter the following information:

      • Class Name: Use one of the following class name.
        • For Banner: AerServDFPCustomEventBanner
        • For Interstitial: AerServDFPCustomEventInterstitial
      • Parameter: AerServ platform ad parameters, in JSON format.
      1.7.1.3 Map Plugin Events

      InMobi banner events are mapped to DFP's CustomEventBannerDelegate events, as follows:

      • -adViewDidLoadAd: → -customEventBanner:didReceiveAd:
      • -adViewDidFailToLoadAd:withError: → -customEventBanner:didFailAd:
      • -willPresentModalViewForAd: → -customEventBannerWillPresentModal:
      • -willLeaveApplicatonFromAd: → -customEventBannerWillLeaveApplication:
      • -adWasClicked: → -customEventBannerWasClicked: & -customEventBannerWillLeaveApplication:
      • -didDismissModalViewForAd: → -customEventBannerDidDismissModal:

      InMobi interstitial events are mapped to DFP's CustomEventInterstitialDelegate events, as follows:

      • -interstitialViewControllerDidPreloadAd: → -customEventInterstitialDidReceiveAd:
      • -interstitialViewControllerAdFailedToLoad:withError: → -customEventInterstitial:didFailAd:
      • -interstitialViewControllerWillDisappear: → -customEventInterstitialWillDismiss:
      • -interstitialViewControllerDidDisappear: → -customEventInterstitialDidDismiss:
      • -interstitialViewControllerWillAppear: → -customEventInterstitialWillPresent:
      • -interstitialViewControllerAdWasTouched: → -customEventInterstitialWasClicked: & -customEventInterstitialWillLeaveApplication:

      InMobi rewarded video events are mapped to DFP's GADRewardBasedVideoAdNetworkAdapterProtocol events, as follows:

      • -interstitialViewControllerDidPreloadAd: → -adapterDidRecieveRewardBasedVideoAd:
      • -interstitialViewControllerAdFailedToLoad:withError: → -adapter:didFailToLoadRewardBasedVideoAdwithError:
      • -interstitialViewControllerDidDisappear: → -adapterDidCloseRewardBasedVideoAd:
      • -interstitialViewControllerDidAppear: → -adapterDidOpenRewardBasedVideoAd:
      • -interstitialViewControllerAdWasTouched: → -adapterDidGetAdClick: & adapterWillLeaveApplication:
      • -interstitialViewControllerDidVirtualCurrencyReward:vcData: → -adapter:didRewardUserWithReward:



      Step 1.7.2 Audience Bidding

      Note: Contact your account manager for Audience Bidding placement setup.
      • Add the additional following framework file:

        to support the IMAB Custom event classes, you'll need an additional framework. You can find this in the following directory of your SDK download: dist/network-support/Google/

        InMobiABAdMobDFPPlugin.framework

        If you are updating your iOS SDK version from a prior version, ensure that you've updated all of these files. Otherwise, if this is your first time integrating, just ensure that you link these files in your project.

      To use the InMobi Audience Bidding SDK, here is how you can expect the flow to go:

      1. The InMobi Audience Bidder SDK will make an ad request and return a bid object
      2. The bid object from InMobi Audience Bidder will have an updated DFPRequest Object and have pricing keywords attached
      3. You then call loadRequest() with the DFPRequest  object as before
      4. If InMobi is selected to fill, The InMobi Audience Bidder SDK will handle the rendering

      Optionally, if you would like to handle the keywords yourself, you may also observe the below flow:

      1. The InMobi Audience Bidder SDK will make an ad request.
      2. The response from InMobi Audience Bidder will have an IMABBidResponse object
      3. You may query the object for the bid keyword, price, granular keyword, InMobi placement, and buyer.
      4. You would then append the bid keyword in customTargeting and set placement id with GADCustomEventExtras using IMABCustomEvent key to DFPRequest object.
      5. You would then call loadRequest() with the DFPRequest  object as before
      6. If InMobi is selected to fill, The InMobi Audience Bidder SDK will handle the rendering
      1.7.2.1 Enabling Audience Bidding Setup on DFP

      To enable Audience Bidding, you will need to do 2 things:

      1. Set up the yield group to use the specific keywords with pricing used by the IMAudienceBidder class.
      2. Update your existing DFP integration details.
      1.7.2.1.1 Setting Up the DFP Yield Groups
      1. Sign in to Google Ad Manager.
      2. Click Delivery > Yield groups.
      3. Click New yield group. Enter a unique yield group Name that's descriptive for reporting.
      4. Select the Ad format and Inventory type you wish to target with this yield group.
      5. Define Key values using the keyword: “IMAB” for different price points. Enter the keyword in the following format IMAB:0.00 (eg. IMAB:0.50)
      6. Then add/map the ad units to these keywords under Custom Targeting.

        DFP_setup_step_6_iOS.png

      7. Ad Exchange will be your default partner/demand source on the UI. Proceed to add additional third-party yield partner and select InMobi (as the ad network) to compete for the targeted inventory.

        DFP_setup_step_7_iOS.png

        Note: Please ensure that the CustomClass name is as follows for Banner and Interstitial

        • Banner: IMABCustomEventBanner
        • Interstitial: IMABCustomEventInterstitial

        Note: Label should be mentioned as: IMABCustomEvent.

      8. Click Save to confirm your changes without activating this yield group for delivery, or click Save and activate to confirm your changes and immediately approve this yield group for delivery.
      9. Once a yield group has been created and activated, Ad Manager is ready to begin using the yield group to fill requests.
      10. Banner Price Points

        Enter the keyword in the "Keyword targeting" in the following format IMAB:0.00 (ex. IMAB:0.50)

        eCPM

        Keyword

        eCPM

        Keyword

        <0.05

        IMAB:0.05

        1

        IMAB:1.00

        0.1

        IMAB:0.10

        1.2

        IMAB:1.20

        0.2

        IMAB:0.20

        1.4

        IMAB:1.40

        0.3

        IMAB:0.30

        1.6

        IMAB:1.60

        0.4

        IMAB:0.40

        1.8

        IMAB:1.80

        0.5

        IMAB:0.50

        2

        IMAB:2.00

        0.6

        IMAB:0.60

        2.5

        IMAB:2.50

        0.7

        IMAB:0.70

        3

        IMAB:3.00

        0.8

        IMAB:0.80

        3.5

        IMAB:3.50

        0.9

        IMAB:0.90

        >4.00

        IMAB:4.00

        Interstitial Price Points

        Enter the keyword in the "Keyword targeting" in this format IMAB:0.00 (ex. IMAB:0.50)

        eCPM

        Keyword

        eCPM

        Keyword

        <0.50

        IMAB:0.50

        7

        IMAB:7.00

        1

        IMAB:1.00

        8

        IMAB:8.00

        1.5

        IMAB:1.50

        9

        IMAB:9.00

        2

        IMAB:2.00

        10

        IMAB:10.00

        2.5

        IMAB:2.50

        12

        IMAB:12.00

        3

        IMAB:3.00

        14

        IMAB:14.00

        3.5

        IMAB:3.50

        16

        IMAB:16.00

        4

        IMAB:4.00

        18

        IMAB:18.00

        4.5

        IMAB:4.50

        20

        IMAB:20.00

        5

        IMAB:5.00

        22

        IMAB:22.00

        6

        IMAB:6.00

        >24.00

        IMAB:24.00

      1.7.2.1.2 Updating Integration Details for Audience Bidding

      For Audience Bidding, here are the required changes that you'll need to do in our code:

      1. Import the InMobi SDK
      2. The IMAudienceBidder is a part of the SDK and will be able to handle most of the functionality required for audience bidding.

        #import <InMobiSDK/InMobiSDK.h>
      3. Initialize InMobi Audience Bidder
      4. You MUST initialize the InMobi Audience Bidder before you make an ad request. Typically, the initialization step may take up to 10 seconds. The initialize method will take in your application site ID (from the InMobi platform). If you have problems finding this information, reach out to your account manager.

        Note: To set the General Data Protection Regulation (GDPR) user consent flag. Pass YES/true for user consent if GDPR user consent was granted and NO/false if user consent was denied or if unknown.

        [IMAudienceBidder initializeWithAppID:kASAppID andUserConsent:@{ IM_GDPR_CONSENT_AVAILABLE : YES }];

        Note:

        • If you would like for InMobi to handle keywords (thus simplifying your integration), follow the below steps for Option A.
        • If you would like to handle the keywords yourself instead, follow the steps for Option B. In addition, you will have to set in customTargeting and set placement id with GADCustomEventExtras using IMABCustomEvent key to DFPRequest object.
      5. Creating or Submitting a bid
        1. Option A: Make an ad request using the bid object

          For Option A, to easily support banner refresh and support subsequent ad requests to the InMobi Audience Bidder, we have a BidObject that you should use.The IMAudienceBidder methods will return a BidObject which you can then call our refreshBid on.

          • The +createBidForAdType: method will return a bidObject which you should retain a strong reference to:
            @property (strong, nonatomic) IMBidObject *bidObject;
          • Please ensure you maintain a strong reference to the DFPRequest:
            @property (strong, nonatomic) DFPRequest *bannerRequest;
          • The +createBidForAdType: method requires for you to pass in an adType, InMobi placement (PLC), DFPRequest, and delegate. Contact your InMobi account manager if you have any questions about this.
          • The adType ENUM: kIMBiddingAdTypeBanner, kIMBiddingAdTypeInterstitial.
          • The setBannerSlotSize:adSize method will use to set the banner size. By default banner size will be 320*50.
          • The +submitBid method will kick off the bidding process with the created bid object. You may review IMAudienceBidder.h for more information.

          A full example snippet for banner and interstitial is available below. InMobi will handle the keywords for you in this option:

          Banner Code Examples
          CGSize bannerAdSize = CGSizeMake(320, 50); CGSize bannerAdSize = CGSizeMake(300, 250); GADAdSize customAdSize = GADAdSizeFromCGSize(bannerAdSize); self.dfpRequest = [DFPRequest request]; self.dfpBanner = [[DFPBannerView alloc] initWithAdSize:customAdSize]; self.dfpBanner.rootViewController = self; self.dfpBanner.adUnitID = DFP_BANNER_ADUNIT_ID; self.dfpBanner.delegate = self;
          // Call createBidForAdType and retain a reference to the bid object to be utilized later self.bannerBidObject = [IMAudienceBidder createBidForAdType:kIMBiddingAdTypeBanner withPlacement:AS_BannerID_AB adObj:self.dfpRequest andDelegate:self];
          // Set the banner ad size [self.bannerBidObject setBannerSlotSize:bannerAdSize]; // Submit the bid to kick off the bidding process [self.bannerBidObject submitBid];
          Interstitial Code Examples
          self.dfpRequest = [DFPRequest request]; self.dfpnterstitial = [[DFPInterstitial alloc] initWithAdUnitID:DFP_INT_ADUNIT_ID]; self.dfpInter.delegate = self;
          // Call createBidForAdType and retain a reference to the bid object to be utilized later self.interstitialBidOBject = [IMAudienceBiddercreateBidForAdType:kIMBiddingAdTypeInterstitial withPlacement:AS_InterstitialID_AB adObj:self.dfpRequest andDelegate:self];
          // Submit the bid to kick off the bidding process [self.interstitialBidOBject submitBid];
        2. Option B: Submit a bid request using submitBidForAdType

          You will not be able to use the BidObject, and you will have to repeatedly call the +submitBidForAdType: method.

          @property (strong, nonatomic) IMBidObject *bidObject;
          • Please ensure you maintain a strong reference to the DFPRequest:
            @property (strong, nonatomic) DFPRequest *bannerRequest;
          • >
          • The +submitBidForAdType: or +submitBidForAdType:adSize method requires for you to pass in an adType, InMobi placement (PLC), and delegate. Contact your InMobi account manager if you have any questions about this.
          • The adType ENUM: kIMBiddingAdTypeBanner, kIMBiddingAdTypeInterstitial
          • The +submitBidForAdType method also will kick off the bidding process (no need to call +submitBid seperately). You may review IMAudienceBidder.h for more information.
          • A full example snippet for banner and interstitial is available below. You will handle the keywords in this example. Call submitBidForAdType and do not use a bid object.

            Banner code examples

            GADAdSize customAdSize = GADAdSizeFromCGSize(CGSizeMake(320, 250)); self.dfpRequest = [DFPRequest request]; self.dfpBanner = [[DFPBannerView alloc] initWithAdSize:customAdSize]; self.dfpBanner.rootViewController = self; self.dfpBanner.adUnitID = DFP_BANNER_ADUNIT_ID; self.dfpBanner.delegate = self;
            // Call submitBidForAdType if you plan to add keywords to the object yourself [IMAudienceBidder submitBidForAdType:kIMBiddingAdTypeBanner withPlacement:AS_BannerID_AB adSize:customAdSize andDelegate:self];

            Remember to add the banner to the view and call show on it once you get the bidReceived delegate callback. For more information about DFP  banner implementation, you can consult the relevant DFP documentation here: https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner

            Interstitial Code Examples

            self.dfpRequest = [DFPRequest request]; self.dfpnterstitial = [[DFPInterstitial alloc] initWithAdUnitID:DFP_INT_ADUNIT_ID]; self.dfpInter.delegate = self;
            // Call submitBidForAdType if you plan to add keywords to the object yourself [IMAudienceBidder submitBidForAdType:kIMBiddingAdTypeInterstitial withPlacement:AS_InterstitialID_AB andDelegate:self];

            Remember to call load on the interstitial once you get the bidReceived delegate callback. You can reference the section below as well to see an example. For more information about DFP interstitial implementation, you can consult the relevant DFP documentation here: https://developers.google.com/ad-manager/mobile-ads-sdk/ios/interstitial.

            Also, do remember to call show when the interstitial has loaded! (when you get the interstitialDidReceiveAddelegate callback from DFP)

      6. Implement the IMAudienceBidderDelegate interface
        1. Option A: The IMAudienceBidderDelegate has 2 methods that need to be implemented:
          • -audienceBidderDidReceiveBidFor:
          • -audienceBidderDidFailBidFor:

          In either scenario (banner or interstitial), you will be returned a DFPRequest for banner and interstitial. If a bid was returned from createBidForAdType, you would then be given an updated DFPRequest  object. If a bid was not returned from createBidForAdType, you get returned a reference of the DFPRequest object with unmodified keywords. Below is an example delegate implementation covering both banner and interstitial:

          - (void)audienceBidderDidFailBidFor:(id)adObject withError:(NSError* ) error { // If the returned and updated adObject is a DFPRequest: if([adObject isKindOfClass:[DFPRequest class]]){ // Load the banner [self.dfpBannerloadRequest:self.dfpRequest]; // Or load the interstitial [self.dfpInterstitial loadRequest:self.dfpRequest]; } } - (void)audienceBidderDidReceiveBidFor:(id)adObject { // If the returned and updated adObject is a DFPRequest: if([adObject isKindOfClass:[DFPRequest class]]) { // Load the banner [self.dfpBanner loadRequest:self.dfpRequest]; // Or load the interstitial [self.dfpInterstitial loadRequest:self.dfpRequest]; } }
        2. Option B: If you prefer to handle keywords yourself, the IMAudienceBidderDelegate has 2 methods that need to be implemented:
          • -audienceBidderDidGenerateBidResponse:
          • -audienceBidderDidFailBidFor:

          For these methods,You would have to append the bid keyword in customTargeting and set placement id with GADCustomEventExtras using IMABCustomEvent key to DFPRequest object. In addition, you may be returned a IMBidResponse object.

          You may access the follow properties on the object:

          • NSString* placement - A NSString that describes the InMobi placement
          • NSString* buyer - A NSString that describes the buyer
          • NSNumber* price - A NSNumber that describes the price
          • NSString* keyword - A NSString that describes a keyword that should be provided to the DFPRequestad object
          • NSString* higherGranularityKeyword - A NSString that describes a granular keyword

          In either scenario (banner or interstitial), if a bid was returned from submitBidForAdType, you would then be given a IMBidResponse object. If a bid was not returned from submitBidForAdType, you do not get returned an IMBidResponse object and you can choose to add additional keywords at this step and/or call loadAd. Below is an example delegate implementation covering both banner and interstitial:

          // Use a Boolean to keep track so you don't call loadAd on the banner repeatedly. Boolean bannerLoaded = false; - (void)audienceBidderDidGenerateBidResponse:(IMBidResponse *)bidResponse {NSArray* bidResponseKey = [bidResponse.keyword componentsSeparatedByString:@":"]; NSDictionary *customTargetingDictionary; if (bidResponseKey.count == 2) {customTargetingDictionary = @{bidResponseKey.firstObject:bidResponseKey.lastObject}; } GADCustomEventExtras *extras = [[GADCustomEventExtras alloc] init]; [extras setExtras:@{kIMABLocalCacheKey : bidResponse.placement} forLabel:@"IMABCustomEvent"]; [self.dfpRequest registerAdNetworkExtras:extras]; // If the bid response placement is a banner if (bidResponse.placement == AS_BannerID_AB) { // Set or append the returned InMobi bidResponse keywords on the DFPRequest self.dfpRequest.customTargeting = customTargetingDictionary; // Set the local extras of the adview // If the banner has not yet been loaded, call loadAd on the updated DFPView      if (!bannerLoaded){ [self.dfpBanner loadRequest:self.dfpRequest]]; } } else if (bidResponse.placement == AS_InterstitialID_AB) {// Set or append the returned InMobi bidResponse keywords on the interstitial self.dfpRequest.customTargeting = customTargetingDictionary // Set the local extras of the interstitial [self.dfpBanner loadRequest:self.dfpRequest];
      7. Implement banner callbacks to support banner refresh with a new bid

        We support DFP automatic banner refresh in the InMobi Audience Bidder SDK for both implementation options, A and B.

        1. Option A: You'll need to include an +submitBid method call in the DFP adViewDidReceiveAd/ didFailToReceiveAdWithErrordelegate callbacks. This will allow us to provide a fresh bid each time the banner is refreshed.

          Note: The submitBid method should only be called after the banner bid object has been constructed to avoid unexpected behavior.

          - (void)adViewDidReceiveAd:(DFPBannerView *)adView { // Ensure that you do not call loadAd again on the DFP Ad View bannerLoaded = true; // On a successful load, call submitBid for the next refresh [self.bannerBidObject submitBid]; - (void)adView:(DFPBannerView *)adView didFailToReceiveAdWithError:(GADRequestError *)error // Ensure that you do not call loadAd again on the DFP Ad View bannerLoaded = true; // On a failed load, still call submitBid for the next banner refresh [self.bannerBidObject submitBid];
        2. Option B: You'll need to include a new +submitBidForAdType method call in the DFP adViewDidReceiveAd / didFailToReceiveAdWithErrordelegate callbacks. This will allow us to provide a fresh bid each time the banner is refreshed.
          - (void)adViewDidReceiveAd:(DFPBannerView *)adView { // Ensure that we do not call loadAd again on the DFPView bannerLoaded = true; // On a successful load, do a new submitBidForAdType for the next refresh [IMAudienceBidder submitBidForAdType:kIMBiddingAdTypeBanner withPlacement:AS_BannerID_AB andDelegate:self]; - (void)adView:(DFPBannerView *)adView didFailToReceiveAdWithError:(GADRequestError *)error { // Ensure that we do not call loadAd again on the DFPView bannerLoaded = true; // On a failed load, still call submitBidForAdType for the next banner refresh [IMAudienceBidder submitBidForAdType:kIMBiddingAdTypeBanner withPlacement:AS_BannerID_AB andDelegate:self];
      8. Get a new interstitial bid
        1. Option A: After an interstitial is shown, you can optionally call 'submitBid' on the interstitial bid object to get a new bid from the InMobi Audience Bidder.

          Note: The submitBid method should only be called after the interstitial bid object has been constructed to avoid unexpected behavior.

          [self.interstitialBidOBject submitBid];
        2. Option B: After an interstitial is shown, you can optionally call 'submitBidForAdType' on to get a new bid from the InMobi Audience Bidder.
          [IMAudienceBidder submitBidForAdType:kIMBiddingAdTypeInterstitial withPlacement:AS_InterstitialID_AB andDelegate:self];
      1.7.2.2 Testing your Audience Bidding Integration

      In order to test your Audience Bidding implementation, you will need to:

      • Make sure you enable test mode on your placement through the UI
      • Set up a line item with:
      1.  CPM 0.00
      2.  Keyword: IMAB:0.00

      Two ways to verify:

      1. Through Charles:
        1. In the ad request we send to DFP (https://pubads.g.doubleclick.net/gampad/ads), check under “Contents” & “JSON Text”, you should see a key value pair of: “cust_params: IMAB:0.00”
      2. Through DFP Reporting:
        1. Make sure the ad filled on testing.
        2. Make sure the numbers align for the newly generated line item at $0.00 (it might take a few minutes for DFP to report it).

    Step 3: Additional Settings (Optional)

    • Disabling App Transport Security for iOS 9+

      Select your application's Info.plist, right-click on it and open as source code. Copy the following code into your Info.plist's xml.
      
      
      <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key><true/> </dict>
    • Muting Interstitial Ads (not supported in InMobi SDK 8.0.1 & 8.0.2)

      Video ads can be muted programmatically. This setting will not affect SDK mediation.
      
      
      #import <InMobiSDK/InMobiSDK.h> @interface ViewController() <ASInterstitialViewControllerDelegate, ASAdViewDelegate> @property(nonatomic, strong) ASInterstitialViewController* asInterstitialVC; @property(nonatomic, strong) ASAdView* asAdView; @end @implementation ViewController /** * Before loading a ad with ASInterstitialViewController, you'll need to set the mute flag. This function will * not work with any SDK mediation. */ - (void)loadInterstitialAd { self.asInterstitialVC = [ASInterstitialViewController viewControllerForPlacementID:@"1000741" withDelegate:self]; self.asInterstitialVC.isMuted = YES; // The flag to toggle mutability. [self.asInterstitialVC loadAd]; } /** * Before loading a ad with ASAdView, you'll need to set the mute flag. This function will not work with any SDK mediation. */ - (void)loadBannerAd { self.asAdView = [ASAdView viewWithPlacementID:@"1024876" andAdSize:ASBannerSize]; self.asAdView.delegate = self; self.asAdView.isMuted = YES; // The flag to toggle mutability. [self.view addSubview:self.asAdView]; [self.asAdView loadAd]; } #pragma mark - Aerserv Interstitial Callback - (void)interstitialViewControllerAdLoadedSuccessfully:(ASInterstitialViewController*)viewController { [viewController showFromViewController:self]; } #pragma mark - AerServ Banner Callback - (UIViewController*)viewControllerForPresentingModalView { return self; } @end
      
      
      class ViewController: UIViewController, ASInterstitialViewControllerDelegate, ASAdViewDelegate { var asInterstitialVC: ASInterstitialViewController? var asAdView: ASAdView? /** * Before loading a ad with ASInterstitialViewController, you'll need to set the mute flag. * This function will not work with any SDK mediation. */ func loadInterstitialAd() { asInterstitialVC? = ASInterstitialViewController(forPlacementID: "1000741", with: self) asInterstitialVC?.isMuted = true // The flag to toggle mutability. asInterstitialVC?.loadAd() } /** * Before loading a ad with ASAdView, you'll need to set the mute flag. This function will not work * with any SDK mediation. */ func loadBannerAd() { asAdView? = ASAdView(placementID: "1024876" andAdSize: ASBannerSize) asAdView?.delegate = self asAdView?.isMuted = true // The flag to toggle mutability. view.addSubview(banner!) asAdView?.loadAd() } //MARK: AerServ Interstitial Callbacks func interstitialViewControllerAdLoadedSuccessfully(_ viewController: ASInterstitialViewController!) { asInterstitialVC?.show(from: self) } //MARK: AerServ Banner Callbacks func viewControllerForPresentingModalView() -> UIViewController! { return self } }
      Muting is turned off by default. If isMuted is set to NO, the control for mutability falls back to the setting on the AerServ + InMobi dashboard.
    • Disabling Interstitial Animation

      To disable the animation for when the interstitial view controller is presented, use the hasAnimation flag within the ASInterstitialViewController object. This would be the animation of the interstitial ViewController scrolling up. When disabled, the ViewController will just appear. By default, this is disabled.
      
      
      #import <InMobiSDK/InMobiSDK.h> @interface ViewController() <ASInterstitialViewControllerDelegate> @property(nonatomic, strong) ASInterstitialViewController* asInterstitialVC; @end @implementation ViewController /** * Before loading a ad with ASInterstitialViewController, you'll need to set the flag to disable the animation. * Note: This will only affect AerMarket, S2S and tags. This function will not work with any SDK mediation. */ - (void)loadAerServAd { self.asInterstitialVC = [ASInterstitialViewController viewControllerForPlacementID:@"1000741" withDelegate:self]; self.asInterstitialVC.hasAnimation = NO; // The flag to toggle view controller's animation. [self.asInterstitialVC loadAd]; } #pragma mark - Aerserv Interstitial Callbacks - (void)interstitialViewControllerAdLoadedSuccessfully:(ASInterstitialViewController*)viewController { [viewController showFromViewController:self]; } @end
      
      
      class ViewController: UIViewController, ASInterstitialViewControllerDelegate { var asInterstitialVC: ASInterstitialViewController? /** * Before loading a ad with ASInterstitialViewController, you'll need to set the flag to disable the animation. * Note: This will only affect AerMarket, S2S and tags. This function will not work with any SDK mediation. */ func loadAerServAd { asInterstitialVC? = ASInterstitialViewController(forPlacementID: "1000741", with: self) asInterstitialVC?.hasAnimation = false; // The flag to toggle the view controller's animation. asInterstitialVC?.loadAd() } //MARK: AerServ Interstitial Callbacks func interstitialViewControllerAdLoadedSuccessfully(_ viewController: ASInterstitialViewController!) { asInterstitialVC?.show(from: self) } }
      Please Note: Disabling the animation won't affect any SDK mediation. You will only see the animation disabled for ads coming from AerMarket, S2S and tags.
    • iOS 12 Wifi Settings

      Enable XCode WiFi Settings From iOS 12 onwards Apple has introduced privacy settings to access WiFi details. If the publisher decides to share wifi details, they can take advantage of targeted ads. Benefits of ad targeting are that, the ads are more useful and meaningful to users.

      How to enable Access Wifi Information

      1. Enable access WiFi information feature to your App ID.



      2. Enable access WiFi information feature for your target app from XCode capabilities.



      3. WiFi Access should get added to your App.entitlements file. If not please add the following code to your App.entitlements file.
        
                      <dict>
                          <key>com.apple.developer.networking.wifi-info</key>
                          <true/>
                      </dict>
                    



      AVAudioSession event changes in WKWebView

      WKWebView ignores AVAudioSessionCategory, Publisher can handle audio interruptions by registering to observe AVAudioSessionInterruptionnotification posted by AVAudioSession. Publisher should ensure minimum possible disruption, and the most graceful possible recovery, from the perspective of the user.



      Observing Audio Interruptions

      To handle audio interruptions, begin by registering to observe notifications of type AVAudioSessionInterruptionNotification.

      
      - (void)registerForAudioInterruptionNotification {
          AVAudioSession *audioSession = [AVAudioSession sharedInstance];
          [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAudioSessionInterruption:) name:AVAudioSessionInterruptionNotification object:audioSession];
      }
      
      - (void)handleAudioSessionInterruption:(NSNotification *)notification {
          
          NSNumber *interruptionType = [[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey];
          NSNumber *interruptionOption = [[notification userInfo] objectForKey:AVAudioSessionInterruptionOptionKey];
          
          switch (interruptionType.unsignedIntegerValue) {
              case AVAudioSessionInterruptionTypeBegan: {
                  /* the system has interrupted your audio session */
                  /* Pause, Save State, Update UI */
                  break;
              }
              case AVAudioSessionInterruptionTypeEnded: {
                  if (interruptionOption && interruptionOption.unsignedIntegerValue == AVAudioSessionInterruptionOptionShouldResume) {
                      /* the interruption has ended */
                      /* Resume, Update State, Update UI */
                  }
                  break;
              }
          }
      }
      


      The posted NSNotification instance contains a userInfo dictionary providing the details of the interruption. You can determine the type of interruption by retrieving the AVAudioSessionInterruptionType value from the userInfo dictionary. The interruption type indicates whether the interruption has begun or has ended. If the interruption type is AVAudioSessionInterruptionTypeEnded, the userInfo dictionary might contain an AVAudioSessionInterruptionOptions value. An options value of AVAudioSessionInterruptionOptionShouldResume is a hint that indicates whether your app should automatically resume playback if it had been playing when it was interrupted. Media playback apps should always look for this flag before beginning playback after an interruption. If it’s not present, playback should not begin again until initiated by the user. Apps that don’t present a playback interface, such as a game, can ignore this flag and reactivate and resume playback when the interruption ends.

      Please Note: There is no guarantee that a begin interruption will have a corresponding end interruption. Your app needs to be aware of a switch to a foreground running state or the user pressing a Play button. In either case, determine whether your app should reactivate its audio session.

      For more details, please refer to the following:
      1. https://developer.apple.com/documentation/avfoundation/avaudiosession/1616596-interruptionnotification
      2. https://developer.apple.com/library/archive/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/HandlingAudioInterruptions/HandlingAudioInterruptions.html

    Version History

      • 8.2.0: 8/5/19
        • Chrome Custom tabs support
        • Thread Optimizations
        • Bug Fixes for SDK and AudienceBidder Plugin
      • 8.1.2: 7/18/19
        • Size reduction
        • Support for Audience Bidding for DFP
        • New api to set slot size for Banner in Audience Bidding
      • 8.1.1: 6/19/19
        • Updated AdColony SDK support to 3.3.10
        • Updated Audience Network (Facebook) support to 5.3.1
      • 8.1.0: 5/14/19
        • DFP Plugin Support
        • Mopub Audience Bidding Plugin Keyword Handling
        • Bug fixes
      • 8.0.8: 4/17/19
        • Bug Fixes
      • 8.0.7: 4/05/19
        • Additional support for higher granularity keywords
      • 8.0.5: 3/11/19
        • Audience Bidder for the Mopub Plugin
        • Telaria Adapter Deprecation
        • Flurry Banner Adapter Deprecation
        • Applovin 3rd Party API Reporting updates
        • Chartboost 3rd Party API Reporting updates
        • Mediated SDK updates
        • Bug Fixes
      • 8.0.2: 12/13/18
        • Mediation bug Fixes
      • 8.0.1: 11/28/18
        • Unified InMobi + AerServ SDK
      • v3.1.6: 10/23/18
        • Bug Fixes
      • v3.1.5: 08/30/18
        • Dynamic Bidding through the MoPub Plugin
      • v3.1.3.2: 08/13/18
        • Bug Fixes
      • v3.1.3.1: 08/09/18
        • Bug Fixes
      • v3.1.3: 07/19/18
        • Bug Fixes
      • v3.1.2.2: 07/03/18
        • Bug Fixes
      • v3.1.2.1: 06/19/18
        • Moat SDK Updated to 3.5.0
        • Moat VPAID Support
        • Admob Mediation Rewarded Video Support
        • Admob Mediation Additional Banner Sizes Support
        • MyTarget iOS SDK Support
      • v3.1.1: 05/11/18
        • The ability to set and update GDPR user consent value on the SDK through the setGDPRWithUserConsent method
      • v3.1.0: 03/30/18
        • Open Auction Implementation
        • AdColony Dynamic Price Adapter Update
        • Vungle Dynamic Price Adapter Update
        • iPhone X Layout Support
        • AdColony SDK version update to 3.3.0
        • Admob/Google Mobile Ads SDK version update to 7.28.0
        • Applovin SDK version update to 4.8.3
        • Chartboost SDK version update to 7.1.0
        • Facebook SDK version update to 4.27.2
        • Flurry/Yahoo SDK version update to 8.4.0
        • Millennial Media (One by AOL) SDK version update to 6.7.0
        • Mopub SDK version update to 4.20.0
        • RhythmOne SDK version update to 6.41.2
        • Telaria/Tremor SDK version update to 3.15.0
        • Unity SDK version update to 2.1.2
      • v3.0.1: 03/08/18
        • Native support
        • InMobi SDK adapter support
        • Vungle adapter update to version 5.3.2
      • v2.42.2: 10/25/17
        • Addressed some minor bugs and included some optimizations.
      • v2.42.0: 10/11/17
        • Support for iOS 11
        • Removal of support for iOS 6.0
        • Updated Rhythm One Mediated SDK Adapter to version 6.4.2
        • Updated Yahoo/Flurry Mediated SDK Adapter to version 8.2.1
        • Updated MoPob Mediated SDK Adapter to version 4.16.0
        • Updated Facebook Mediated SDK Adapter to version 4.25.0
        • Updated AdColony Mediated SDK Adapter to version 3.2.1
        • Updated Chartboost Mediated SDK Adapter to version 7.0.1
      • v2.41.1: 08/22/17
        • Added logic to respect the end users device muting setting
        • Additional reporting optimization
        • Enabled bitcode to be configurable
      • v2.41.0: 08/08/17
        • Updated Mediation SDK Adapters
        • Tremor SDK update to 3.14.1.142
        • Millennial SDK update to 6.4.0
        • MoPub SDK update to 4.15.0
        • Flurry/Yahoo SDK update to 8.1.0
        • Facebook SDK update to 4.24.0
        • Enabled support for VAST 3.0
        • Resolved known issues with Admob and Appnexus mediated SDK
      • v2.40.1: 07/05/17
        • Header bidding support
        • Updated MoPubSDK to 4.13 in the Fabric Sample App
        • MoPub Sample App: The delegate is using the wrong parameter for MPAdView
        • Rewarded Video support through MoPub Plugin
        • Addressed some minor bugs and optimization
      • v2.39.5: 06/21/17
        • Enabled bitcode on the SDK
      • v2.39.4: 04/03/17
        • Updated AdMob SDK to 7.19.0
        • Updated MoPub SDK to 4.13.0
        • Updated AdColony SDK to 3.1.1
        • Removed camera and photo permission for MRAID
      • v2.39.3: 03/24/17
        • VPAID modification to prevent hanging on white screen after ad times out
        • VAST media files parsing modification for better media file selections
        • Added html decoder for encoded vast being passed in the ad parameters
        • Updated Vungle SDK to Version 4.0.9
        • Updated Facebook SDK to Version 4.20.2
      • v2.39.2: 03/13/17
        • Fixed issue with Banner Refresh
        • AdColony 3.1 Update
      • v2.39.1: 03/07/17
        • Update AppLovin to 3.5.2
        • Additional updates to the Ad Colony 3.0
        • Reallocation of ad serving logic onto the ad server
        • Adjustment to VAST/VPAID multiple media files
        • Refactored the wkwebview to prevent crashes
      • v2.38.2: 02/23/17
        • Updated AdColony SDK to 3.0
      • v2.38.1: 02/10/17
        • Updated AppNexus Plugin
      • v2.38.0: 02/07/17
        • Added support for ad pods
        • Minor bug fix to better handle the closing of end cards
      • v2.37.1: 01/12/17
        • Implemented Webkit support for iOS 10
        • Resolved Non-Public API issues with our mediated ad sources
        • Improved VPAID handling for iOS 9 and 10
        • Reporting and Event handling improvements
        • Adding API call to get SDK Version
      • v2.36.0: 11/30/16
        • Enabled the ability to support mute as a setting at the placement level
        • Added support for myTarget Mediation adapter
      • v2.35.1: 11/17/16
        • Improvements on handling 'init' calls
        • Improvements and fixes to Applovin, Adcolony and Rhythmn One mediation adapters
        • Fixed VAST errors
      • v2.35.0: 09/29/16
        • Updates to support iOS 10
        • Updated AdColony Privacy Config
        • Updated AdMob SDK to 7.11.0
        • Updated AppLovin SDK to 3.4.3
        • Updated Chartboost SDK to 6.5.1
        • Updated Facebook SDK to 4.15.1
        • Updated MillennialMedia SDK to 6.3.1
        • Updated Mopub SDK to 4.9.1
        • Updated Tremor SDK to 3.13.0.72
        • Updated Vungle SDK to 4.0.5
        • Minor Tracking improvements
      • v2.34.2: 09/22/16
        • Removed all non-public APIs that's preventing apps from getting approved from iTunes.
      • v2.34.0: 08/23/16
        • Updated Chartboost SDK to 6.4.7
        • Updated Applovin SDK to 3.4.0
        • Updated Adcolony SDK to 2.6.1.1
        • Changes to Rewarded Events
      • v2.33.0: 07/28/16
        • Added support for Rhythm One SDK Adapter
        • Updated events for reporting fixes
        • Improvement on handling VAST and VPAID creatives
      • v2.32.2: 07/07/16
        • Addressed minor rotation issues with VPAID ads
        • Fixed small memory leak issue
      • v2.32.1: 06/09/16
        • Updated events for reporting fixes.
      • v2.32.0: 06/06/16
        • Added support for Millennial Media SDK adapter
        • Enabled the capability to turn on MOAT for demand partners.
      • v2.31.0: 05/11/16
        • Supports ad campaigns that require end card
        • Fixes to Rewarded Video events with AdColony and Vungle
      • v2.30.0: 04/28/16
        • Added support for Tremor SDK adapter
        • Enabled publishers to view the mediated ad source name and price information, associated to the filled ad.
        • Support for VAST 3.0
        • Supports IAB MRAID Video Addendum
        • Minor fixes to the sample/test app
      • v2.29.6: 03/21/16
        • Add Serverside callback for Virtual Currency
        • Add an optional variable to associate ad requests with a user id.
      • v2.29.5: 02/16/16
        • Fix Banner Ad failed event on custom network adapter
      • v2.29.4: 02/01/16
        • Fix minor issue with MRAID
        • Enable Skip for Vast Banner
        • Improve Mediation Adapters
      • v2.29.3: 12/14/15
        • Add PreInit Method to Adcolony and AppLovin SDK mediation
      • v2.29.2: 12/07/15
        • Improve 3g connection buffering
        • Fix minor issue with DSYM
      • v2.29.0: 11/20/15
        • Centering MRAID Banners on Pre-iOS9 devices
        • Adding Parsing initial HTML to determine future orientation
        • Addressed the iOS 6 minor bug
      • v2.28.1: 11/02/15
        • Fix minor bug
      • v2.28.0: 09/22/15
        • Add method to pass in location for iOS8 in info.plist
        • Sample app change for iOS9 arbitrary (ATS) loads config update
        • Adding HTTPS SSL
        • Update and Improve client/server protocol
        • Add Publisher Key Values string method
        • Fix minor bugs
        • Post SDK binaries to Cocoapod
        • Improve vast on slower connection
        • Add New Network Support Adapters
          • Facebook Audience Network
          • Applovin
          • Chartboost
          • Unity Ads
          • Mopub SDK
      • v2.27.0.2: 08/17/15
        • Fixed minor bugs
        • Supports pre-cache Video
        • Implemented count down timer for Video Ads
        • Fixed quartile event bug
        • Updated AdMob SDK to 7.3.1.2
        • Resolved issue with keyword feature
      • v2.26.0: 07/8/15
        • Add VPAID for iOSsupport
        • Add Preload events in debugging log to sample app
        • Add Preload ready UI notification
        • Adjustment for logging to occur in sample app
        • Add VAST rigidity failover support
        • Fixed minor bugs
        • Fixed typo in event callbacks:
          • interstitialViewControllerAdFailedToLoad
          • interstitialViewControllerWillAppear
          • interstitialViewControllerDidAppear
        • Change preloadAd, virtualCurrencyLoad, virtualCurrencyReward — from adView to interstitial
      • v2.25.2: 06/08/15
        • Add Preloading Banner Video method
        • Add Video Completed event for banner
        • Separate Banner and interstitial Preload event
        • Add support for Full Screen video in Landscape mode
        • Update User agent parameter
      • v2.24.1: 06/02/15
        • Force full screen for video
        • Implemented Fabric/MoPub plugin
        • Fixed minor bug in iOS 6/7 crash
        • Enhance video ad completed dismiss animation
        • Improvesample app
        • Improve VAST parser
        • Add video size auto scaling support
      • v2.23.0: 05/01/15
        • Removed calls to clearCache
        • Add Preloading method with sdk & s2s mediation
        • Fixed minor bugs:
        • Added Show button to sample app
        • Removed alert dialogs in sample app
      • v2.22.0: 03/02/15
        • Update Vungle & AdColony Adapter
        • Minor bug fixes
      • v2.21.0: 02/19/15
        • Update AdMob adapter
        • Add Adcolony callback event
      • v2.20.0: 01/16/15
        • Fixed unregister throwing exception
        • Fixed null urls throwing exceptions
      • v2.19.0: 01/05/15
        • Changed interstitial delegate from assign to strong to prevent premature garbage collection
        • Added support for pub skip via vast wrappers
        • Sample apps now correctly min keyboard on loss of focus
      • v2.18.0: 12/05/14
        • Simple Integration API
        • Fixed user agent bug
        • Fixed vast wrapper bug
        • Play/pause banner
        • Play/pause interstitial
        • Fixed Keywords bug
      • v2.17.0: 11/04/14
        • Added vast 3.0 skip offset.  Including skip events as specified by vast 3.0 spec. Progress events will be in at a later time
        • Added the ability to add keywords to the call
        • Fixed bug where faulty unwrapped vasts were not failing over
        • Fixed user agent and removed system name which always returned iphone os
      • v2.16.0: 10/14/14
        • Timeout option on facades
        • Lat/Long now being sent on requests
        • adid and dnt being sent on requests
        • bunldeid being sent on request
        • Event is now firing correctly upon user close ad
        • Added YuMe adapter
        • Fixed lock screen on/off crash issue
        • Removed Adtech adapter
        • Fixed issue where Vungle/iAd/AdMob failover would fail due to newly added timeout feature
        • Updated AdMob SDKto 6.12.0
        • Removed ability to scroll banner ads
        • Added in bitmap check for failover
        • Fixed click through url encoding issue
        • Fixed AdColony upside down issue
      • v2.15.0: 10/02/2014
        • New adapters for the Yume and Adtech SDKs (Max version).
        • Fixed a crash when lock/unlock during ad playback.
        • Added a timeoutInterval property to ASAdView and ASInterstitialViewController.
        • Fixed a problem with lat/long not being passed correctly.
        • Tested for iOS 8 and iPhone 6
      • v2.14.0: 09/11/2014
        • Added SpecificMedia adapter.
      • v2.13.0: 08/08/2014
        • Updated the sample app menus.
      • v2.12.0: 08/07/2014
        • Added PhoneGap and Cocos2D adaptor and sample apps.
        • Updated the Unity adaptor.
      • v2.11.0: 08/04/2014
        • Video ads now resume when apps enter foreground.
        • Changed the user agent for ad related network calls.
        • Fixed certain missing video events.
      • v2.10.0: 06/20/14
        • Fixed random popup of 'Ad Failed to Load' alert after and ad rendered.
        • Added a Unity plug in and a sample Unity application.
        • Added AdColony, AdMob, iAds and Bungle SDK adapters.
      • v2.9.0: 06/10/14
        • Exposed clickthrough delegates.
        • Fixed a crash on malformed XML responses.
        • Forced landscape orientation on iPhone when playing videos.
        • Improved the sample app UI.
      • v2.8.0: 05/21/14
        • Fixed a crash when rendering certain video ads.
      • v2.7.0: 05/19/14
        • Added missing arm64 architecture to the SDK library.
      • v2.6.0: 05/16/14
        • Fixed sample project to run in simulator.
      • v2.3.0: 05/09/14
        • Initial release.
      The previous 1.x version are deprecated with the release of version 2.0. Version 2.0 provides support for new advanced features including client side failover and complex ad units.

    exchange | Getting Started new draft

    This guide is for all app developers and publishers who wish to monetize the ad inventory on their iOS or Android apps using the light weight InMobi SDK. Before you begin integrating the SDK into your app, please follow the steps below to set up an account with InMobi, register your app and create ad placements:

    Follow the simple steps and get started:

    Along the way, we have highlighted important guidelines and best practices to ensure you have everything in place to monetize your app quick and easy without our assistance. Ensure that you pause for a moment to read through these messages.

    Step 1: Signup with InMobi

    Now that you’re here and InMobi is the chosen one, what are you waiting for? Let’s get started with your account right away. To set up an InMobi account:

    1. Sign up as a publisher.
    2. A verification email with a link will be sent to your registered email address. Click on the link to complete the verification process. (This address will be used for any future communication about your account).
    3. On log in, choose the applicability pertaining to GDPR.

    Step 2: Register your App

    Once you have created an account, you can proceed to register your app with InMobi. The following steps are only meant for apps published in an app store. If you have an app that is yet to be published, visit Step 2A. Let's proceed.

    1. Click Add an app

    2. Select your relevant Operating System
    3. Enter a valid app store URL
    4. Click Add to list additional apps you wish to monetize.
    5. View your completed profile from the drop down next to your user name.

    Important: Please take a moment to read the compliance guidelines for properties directed to children below 13 years, and then select the check box if it applies to you.

    Step 2A: Register an Unpublished App

    If you have an unpublished app that is not live in the app store, just follow the simple steps below:

    1. Sign up as a Publisher.
    2. Complete the verification e-mail sent to the registered ID (The registered email ID here will receive all the communication).
    3. Choose the applicability pertaining to GDPR.
    4. Click Add app as shown in the dialog box.
    5. Choose operating system.
    6. When it's published, you can return to InMobi and link your app to its app store entry.

    Remember: For apps without a URL, the test mode is enabled by default. Once live, you can click the link to enter the URL on the dashboard as shown below.

    Step 3: Create Placements

    1. Select the relevant ad format to define the placement of your app.

    2. Scroll to your right/left to see more placements
    3. Enter details in Placement Name and click Create Placement
    4. Click Add Placement to create additional placements
    5. Once the setup is complete, you will get an overview of the placement details.

    Important:
    For Rewarded Video, please set the placement type to Interstitial.
    For Native ad units, please ensure the right format and aspect ratio is selected.

    Step 4: Update Payment Profile

    Create, verify and activate your payment profile to make your earnings tangible! InMobi follows a payout cycle of 60 days. This means that your earnings for a given month will be credited to you at the end of the 60-day payout cycle. You have the option of receiving your payouts via PayPal or wire transfer/RTGS.

    Note: This is a mandatory step and all publishers are requested to complete the details to monetize successfully.

    1. Select Earnings from the drop down next to your user name
    2. Select Add Account
    3. Add the following details:
      • Mode of Transfer
      • Bank Details
      • PAN Card Details
      • GST Details
    4. Once the setup is done, you will get an overview of your Payment Page.

    Note: Your Payment Id is available under your account summary as shown below. You will be able to view it, after the payment details you provided are verified and approved.

    Step 5: Control Ad Experience with Filters

    By using the blocking controls built into InMobi, you can curate the experience shown to the user by reviewing and controlling the ads that appear in your app. InMobi supports ad filters at three levels to control the ad experience:

    Level 1: Domain Filters

    You can block ads from specific URLs. For example, you might not want to show your competitors' ads on your apps.


    Level 2: URL or Keyword Filters

    You can block ads by filtering URLs /Keyword Filters based on their ad text or landing page URL. For example, you can prevent ads containing the text 'weapons' or 'virus' from serving on your site or app.


    Level 3: Category Filters

    You can block ads from specific categories which will not be served on your app. The categories range from Business, Art, Finance, Fashion etc. For example, an app meant for kids has the option to block ads from specific categories.

    Note: InMobi provides provision for blocking sensitive categories. You can block ads being served on content that includes topics such as politics, religion, mature content, gambling, etc.

    Note: Blocking any ad will lower your potential earnings as it reduces competition for your inventory by removing advertiser bids from the auction. We recommend blocking only those ads that you feel are absolutely irrelevant and inappropriate to your content or your users.

    exchange | Migrating to SDK 9xx

    InMobi’s SDK 9xx (iOS 12 and Android 10 compliant), brings a superior monetization opportunity for your apps. The upgrade is super simple with just a drag-n-drop integration coupled with few compliance steps.


    The new integration guides are available here: iOS & Android.


    The latest version of InMobi SDK supports:

    • iOS - minimum iOS 9 and XCode 10.2
    • Android - minimum Android 4.1 (API level 16)

    Migration prerequisites for iOS

    Wifi Settings

    Apple has introduced privacy settings to access WiFi details from iOS 12 onwards. To boost monetization and relevant user experience we encourage sharing WiFi details for targeted advertising. This can be done in three steps as shown below:

    Step 1: Enable ‘Access WiFi Information’ on your App ID.

    Step 2: Enable access ‘Access WiFi Information’ for your target app from XCode capabilities.

    Step 3: Ensure WiFi Access is added to your App.entitlements file.

    Migration prerequisites for Android

    1. Preparing For Android P

    InMobi SDK is compatible with Android P (API level 28), the latest version of the Android platform. In Android P and onwards, apps make connections over HTTPS by default. Though InMobi supports the adoption of HTTPS, the current setup requires our demand partners to support HTTPS as well. The publisher can change their settings to HTTP if it has an impact on the revenue potential.


    2. Preparing your app for AndroidX (JetPack)

    InMobi SDK is compatible with AndroidX (JetPack) library. In case your app uses the AndroidX library, then 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 taht you 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 the Android developer documentation.

    3. New Bundle format - aar

    Android SDK has moved to a new format bundle, ‘aar’ for ease of integration. With InMobi SDK 800+, you do not need to add InMobiAdActivity into your application manifest.

    Note: InMobi SDK 900 and above will include the mandatory permissions automatically to the application manifest in order to proceed. Permissions added are as follows:

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

    It is highly recommended to include the library from jCenter by adding the following line in your app/build.gradle:

    implementation 'com.inmobi.monetization:inmobi-ads:9.0.1'
    	

    But in case you’re manually integrating the SDK, include the .aar file into the project using the following:

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

    4. Changing the Manifest File (if migrating from SDK < 8XX)

    Please remove InMobiAdActivity element from your manifest as aar file will take care of that.

    5. Added API(s)

    The following API has been added:

    • InMobiBanner
      public void destroy()
    	

    6. Removed APIs

    The following legacy APIs have been removed :

    • InMobiNative
        public InMobiNative(Context context, long placementId, NativeAdListener listener)
        public void setNativeAdListener(NativeAdListener listener)
        public static void requestAd(.......)
      		
    • InMobiNative.NativeAdListener
    • InMobiBanner
      public void setListener(BannerAdListener listener)
      public static void requestAd(.......)
      		
    • InMobiBanner.BannerAdListener
    • InMobiInterstitial
      public InMobiInterstitial(Context context, long placementId, InterstitialAdListener2 listener)
      public void setInterstitialAdListener(InterstitialAdListener2 listener)
      public static void requestAd(.......)
      		
    • InMobiInterstitial.InterstitialAdListener2

    Note: For the project to compile, please remove any invocation of this API.

    exchange | Android Mopub new draft

    Integrating and monetizing InMobi SDK with Mopub is easy. Please refer this guide for integration instructions.

    You have access to the following ad types from InMobi via Mopub mediation.

    • Banner
    • Medium - Banner
    • Fullscreen (Interstitial, Full-screen Video Ads)
    • Rewarded Video
    • Native

    Before you begin setting up InMobi as an ad source on Mopub dashboard, it’s important that you create an InMobi account, register your app, configure placements and complete the payment information. You can learn more about it here.

    If you have completed the above steps, they you are all good to begin setting up InMobi as an adsource on Mopub. Let’s begin!

    Step 1: Configuring InMobi as an Ad Source on MoPub’s Dashboard

    Log on to your MoPub account and identify the ad units that you wish to monetize via InMobi. Then, navigate to the Networks tab.

    1. To monetize via InMobi, select Custom SDK Network. It allows you to integrate InMobi via MoPub with plug-n-play “Custom Events”.

      Note: You need both the InMobi SDK and the custom event for successful integration.

    2. Navigate to the specific ad unit that you want to monetize via InMobi.

    3. Enter the name of InMobi custom event class specific for that particular ad format as Custom Event Class value. For example, Interstitial Ad - the custom event is called: “com.inmobi.showcase.InMobiInterstitialCustomEvent”.

      Use fully qualified Custom Event class names. Here is the complete grid for custom events by ad unit type:

      Ad Unit

      Class Name

      Banner

      <your_package_name>.InMobiBannerCustomEvent

      Medium (300x250 banner)

      <your_package_name>.InMobiBannerCustomEvent

      Fullscreen

      <your_package_name>.InMobiInterstitialCustomEvent

      Rewarded Video

      <your_package_name>.InMobiRewardedCustomEvent

      Native

      <your_package_name>.InMobiNativeCustomEvent/

      <your_package_name>.InMobiNativeStrandCustomEvent

      Note: Please note that the package name <your_package_name> should be replaced with the actual package name in which the custom event classes are placed in the app.

    4. Your account ID is available in your InMobi account as illustrated in the screenshot below.

    5. Placement ID is present under the Placements section as illustrated in the screenshot below.

    6. Enter the Account ID and the Placement ID in the following format in the placeholder for Custom Event Class Data:
        {“placementid”: “<Enter your InMobi Placement ID here>”,”accountid”:”<Enter your InMobi Account ID here>”}
      		

      A sample input will look like this:

        {“placementid”:”1468850508657”,”accountid”:”2072131215e04a5ea20e25ffec1a7171”}
      		

    Step 2: Adding the SDK and Custom Event to your Project

    Option 1: Pulling the Latest SDK via JCenter

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

    1. Include JCenter in your top-level build.gradle file
      allprojects {
          repositories {
              jcenter()
          }
      }
      		
    2. Add the following line to the dependencies element in your application module’s build.gradle.
                  implementation 'com.inmobi.monetization:inmobi-ads:9.0.0'
      		
    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

    Alternately, 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])
    	
    Step 3: Adding and Verifying the Dependencies

    To monetize with the InMobi Ad 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 lines 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.0.0'
      		
    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 'com.android.support:customtabs:28.0.0'
    2. Sync your Gradle project to ensure dependencies are included.

    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'
      		

    Note: 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 do so, add the following line to the application module’s dependency element in the Gradle build script.

                implementation '<strong>com.android.support:support-v4:28.0.0</strong>'
    	

    RecyclerView

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

    To do so, add the following line to the application module’s dependency element in the Gradle build script.

                implementation '<strong>com.android.support:recyclerview-v7:27.1.0</strong>'
    	

    Note: 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 mark your application as multidex enabled:
      defaultConfig {
                  applicationId "com.inmobi.samples"
                  minSdkVersion 15
                  targetSdkVersion 29 
                  versionCode 1
                  versionName "1.0.0"
                  multiDexEnabled true // add this to enable multi-dex
              }
      		
    2. Add the following line to the dependencies element in your application module’s build script.
                  compile 'com.android.support:multidex:1.0.3'
      		

    Step 3.1: 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.

    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 AVID classes
    -keep class com.integralads.avid.library.* {*;}
    	

    Important Prerequisites:

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

    Checkpoint 1: Preparing Your App for Android 10

    InMobi SDK is compatible with Android 10 (API level 29), the latest version of the Android platform.

    On Android P onwards, apps make connections over HTTPS by default. Though InMobi supports the adoption of HTTPS, the current setup requires our demand partners to support HTTPS as well. The publisher can change their settings to HTTP if it has an impact on the revenue potential.

    Checkpoint 2: Preparing Your App for AndroidX

    InMobi SDK is compatible with AndroidX (JetPack) library. In case your app uses the AndroidX library, then 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.

    Step 3.2: Add the Custom Event

    Add the custom events to your MoPub project. The custom events for different ad formats are also available as part of the sample code available here . The custom events are available under the relevant package structure. The code also has sample activities to illustrate how to mediate via MoPub SDK.

    Code Steps

    The code steps remain the same as they are for regular MoPub integration for fetching and loading an ad. Use the regular MoPub “ad unit id” to request and fetch an ad.

    Step 3.3: Passing user consent information to InMobi SDK

    The publishers monetizing in EEA region will have to pass user consent to InMobi SDK. The publishers can use consent gathering mechanism of their choice, and they will have to pass on this consent information to InMobi.

    • The publisher has to copy InMobiGDPR class into the project.
    • Use InmobiGDPR.grantConsent() or InmobiGDPR.revokeConsent() APIs to pass on user consent. Publisher will have to grant or revoke consent based on the consent provided by the user. It should be called once every session. In case grantConsent() is not called, we will presume that consent is not available for users belonging to EEA+UK+Switzerland region.
    • If the user consent is revoked at any point of time, the publisher has to call InmobiGDPR .revokeConsent() to notify InMobi about the same.
    • Use InMobiGDPR.isGDPRApplicable() to let InMobi know whether user belongs to GDPR compliant region.

    More Information

    You can see the complete sample code and example here

    The latest documentation and code samples for the MoPub SDK are available here.

    Step 5: Testing the Integration

    To ensure MoPub SDK relays the ad request to InMobi for testing:.

    1. Set manual Ad network optimization for every network including MoPub.
    2. Set manual eCPM floors for all networks keeping the eCPM floor for InMobi higher than other networks, this will ensure that the ad request gets relayed to InMobi for testing. For example for InMobi set the floor to $5 while MoPub marketplace is set to $0.05.


    Step 5.1 Enabling Key SDK Logs

    You can enable key SDK logs by adding the following line to your Activity while integrating the ad-units.

                InMobiSdk.setLogLevel(LogLevel.DEBUG);
    	

    You can also leverage feedback available on the diagnostics tab on the ad unit and ad request if you have enabled “Test Mode” on InMobi portal.

    Step 6: Advanced Configurations

    Pass the location information 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, modify the Custom Event class for your ad-unit to pass on the data using the InMobi SDK API. Please see sample code for more details.

    InMobi supports the following parameters:

    Method Name

    Value

    Description

    setAgeGroup

    AgeGroup.BELOW_18

    AgeGroup.BETWEEN_18_AND_20

    AgeGroup.BETWEEN_21_AND_24

    AgeGroup.BETWEEN_25_AND_34

    AgeGroup.BETWEEN_35_AND_54

    AgeGroup.ABOVE_55





    The age group of the user

    setEducation

    Education.HIGH_SCHOOL_OR_LESS

    Education.COLLEGE_OR_GRADUATE

    Education.POST_GRADUATE_OR_ABOVE

    The education level

    • High school, or less
    • College, or graduate
    • Postgraduate, or above

    setAge

    Integer

    The age of the user

    setInterests

    Any String

    Any additional relevant description of the user, or their preferences, separated by commas. Valid acceptable values are mentioned below

    setPostalCode

    Any String

    The postal code (usually a 5 digit number)

    setAreaCode

    Any String

    The area code (part of the telephone number)

    setLanguage

    Any String

    The native language of the user (if known)

    setLocationWithCityStateCountry

    Any String

    Sets location with City, State, Country being passed

    setKeywords

    Any String

    Keywords to be passed in the ad request

    Here is a sample for setting up the InMobi SDK Demographic params. The publishers need to set the values of params as they want.

    InMobiSdk.setAreaCode("080");
    InMobiSdk.setEducation(Education.HIGH_SCHOOL_OR_LESS);
    InMobiSdk.setGender(Gender.MALE);
    InMobiSdk.setAge(23);
    InMobiSdk.setPostalCode("122009");
    InMobiSdk.setLogLevel(LogLevel.DEBUG);
    InMobiSdk.setLocationWithCityStateCountry("blore", "kar", "india");
    InMobiSdk.setLanguage("ENG");
    InMobiSdk.setInterests("dance");
    InMobiSdk.setYearOfBirth(1980);
    	

    exchange | Audience Bidding for MoPub (iOS)

    Setup

    In order to start setting up, you’ve to ensure that the steps mentioned in the InMobi Integration have already been incorporated.

    Step 1: Initialising the InMobi SDK

    Option 1. Initialise InMobi SDK while Initialisating MoPub SDK using MPMoPubConfiguration. Follow instructions as mentioned here

    #import <InMobiMoPubPlugin/InMobiAdapterConfiguration.h> 
    MPMoPubConfiguration *sdkConfig = [[MPMoPubConfiguration alloc] 
        initWithAdUnitIdForAppInitialization: <MoPubAppId>]; 
    sdkConfig.additionalNetworks = [NSArray 
        arrayWithObject:InMobiAdapterConfiguration.class]; 
    NSMutableDictionary *inmobiDict = [[NSMutableDictionary alloc] 
        initWithObjectsAndKeys:@"<InMobiAccountID>", @"accountid", nil]; 
    NSMutableDictionary *configDictionary = [[NSMutableDictionary alloc] 
        initWithObjectsAndKeys:inmobiDict, @"InMobiAdapterConfiguration", nil]; 
    sdkConfig.mediatedNetworkConfigurations = configDictionary; 
    [[MoPub sharedInstance] initializeSdkWithConfiguration:sdkConfig 
        completion:^{ 
            NSLog(@"Mopub and third party SDKs are initialised"); 
    }];
    	

    Note : Import the InMobiAdapterConfiguration.h header

    Option 2: Initialise InMobi SDK directly

    NSError* error= nil; 
    [InMobiSDKInitialiser initialiseSDK:[info valueForKey:kIMAccountID] 
        withError:&error];
    	

    Note : Initialize once per app’s lifecycle, typically on app launch, using valid account ID for your app. Make no ad requests until the SDK initialization has completed.

    Step 2: Adding the InMobiMoPubPlugin to your Project

    Option 1: Using CocoPods

    pod 'InMobiMoPubPlugin'
      pod 'InMobiSDK'
    	

    Note : Add pod 'mopub-ios-sdk' for resolving dependancy.

    Option 2: Adding the SDK Library to your Application Project

    Add the framework in your project. Download the MoPub-InMobi plugin from here

    Note : If the version is X.Y.Z.A , X.Y.Z denotes the compatible media SDK version whereas A denotes the patch number.

    Banner Ads

    Step 1: Setting up and adding Banner Ad to your App

    Creating a Banner Ad

    To add a banner ad in iOS code, create an instance of IMABMoPubBanner:

     IMABMoPubBanner* bannerAd = [[IMABMoPubBanner alloc] initWithSize:<size> 
        placementId:<placementID> delegate:<delegate>];
    	

    Notes

    • The IMABMoPubBanner class is not thread-safe. A banner instance must be created on the main thread.
    • Similarly, all methods on this instance must be called on the main thread. Not doing so will lead to unpredictable behavior and may affect your ability to monetize with InMobi.

    Step 2: Requesting for Bid

    Requesting for a bid requires you to call the IMABMoPubBanner: requestBid method on the instance you just created to request for a bid. Note that there are two API(s) available to request for a bid -

    • IMABMoPubBanner: -(void)requestBid:(nullable id)ad timeout:(NSTimeInterval)timeout; When you pass a MoPubView instance, the InMobi SDK automatically takes care of setting the keyword to this instance and saving the IMBanner instance for future usage in CustomEvent class.
      /** 
      * A sample code to request bid with MoPubView 
      */ 
      @interface BannerViewController () <IMABMoPubDelegate, MPAdViewDelegate> 
      //Hold the instance of IMABMoPubBanner, to load an InMobi's ad. 
      @property (nonatomic, strong) IMABMoPubBanner* abMoPubBanner; 
      @property (nonatomic, strong) MPAdView* mpBanner; 
      @end 
      @implementation BannerViewController 
      - (void)loadUABannerAd { 
          // Write code to initialise your MoPub ad object and then do the following 
          self.mpBanner = [[MPAdView alloc] initWithAdUnitId:<adUnitID> size:
              <adSize>]; 
          self.mpBanner.delegate = <delegate>; 
          //Create an instance of IMABMoPubBanner and call requestBid 
          self.abMoPubBanner = [[IMABMoPubBanner alloc] initWithSize:<size> 
              placementId:<placementID> delegate:<delegate>]; 
          [self.abMoPubBanner requestBid:self.mpBannerTop timeout:<timeout>]; 
      } 
      #pragma mark - IMABMopubBannerDelegate method 
      /** 
      * Notifies Bid is recieved successfully with transaction keyword. 
      * @param mpAd MoPub ad object passed in requestBid. It can be either MPAdView or MPInterstitialAdController type 
      *          It will be null if the MoPub ad object was not passed while calling the requestBid API 
      * @param imAd InMobi ad Object for which the keyword is recieved. In case of nil mpAd, set imAd inside localExtras of mopub 
      *          ad object. Kindly refer intergation document. 
      * @param keyword  keyword derived from the bid received. 
      */ 
      - (void)bidReceivedFor:(nullable id)mpAd andInMobiAd:(id)imAd 
          withTransactionInfo:(NSString*)keyword { 
              NSLog(@"Test MP Banner:- bidReceivedFor withTransactionInfo: %@", keyword); 
              [self.mpBanner loadAd]; 
              //add mpBanner to the subView. 
      } 
      /** 
      * Notifies Bid fetch is failed with error. 
      * @param ad MoPub ad object passed in requestBid. It can be either MPAdView or MPInterstitialAdController type 
      *          It will be null if the MoPub ad object was not passed while calling the requestBid API 
      * @param error error which caused failure. 
      */ 
      - (void)bidFailedFor:(nullable id)ad withError:(NSError*)error { 
          NSLog(@"Test MP Banner:- bidFailedForAd withError: %@", error); 
      } 
      @end
      		
    • IMABMoPubBanner: -(void)requestBid:(NSTimeInterval)timeout; In case you don’t wish to pass the MoPubView instance, then you need to take care of not only setting the keyword to the MoPubView instance (for which bid was requested) but also you’ve to pass IMBanner instance to CustomEvent for rendering the ad, for that we create an instance of IMFacadeWrapper and add it in the localExtras of MPAdView, as mentioned in the following code:
      /** 
      * A sample code to request bid without MoPubView 
      */ 
      @interface BannerViewController () <IMABMoPubDelegate, MPAdViewDelegate> 
      //Hold the instance of IMABMoPubBanner, to load an InMobi's ad. 
      @property (nonatomic, strong) IMABMoPubBanner* abMoPubBanner; 
      @property (nonatomic, strong) MPAdView* mpBanner; 
      @end 
      @implementation BannerViewController 
      - (void)loadUABannerAd { 
          // Write code to initialise your MoPub ad object and then do the following 
          self.mpBanner = [[MPAdView alloc] initWithAdUnitId:<adUnitID> size:
              <adSize>]; 
          self.mpBanner.delegate = <delegate>; 
          //Create an instance of IMABMoPubBanner and call requestBid 
          self.abMoPubBanner = [[IMABMoPubBanner alloc] initWithSize:<size> 
              placementId:<placementID> delegate:<delegate>]; 
          [self.abMoPubBanner requestBid:<timeout>]; 
      } 
      #pragma mark - IMABMopubBannerDelegate method 
      /** 
      * Notifies Bid is recieved successfully with transaction keyword. 
      * @param mpAd MoPub ad object passed in requestBid. It can be either MPAdView or MPInterstitialAdController type 
      *          It will be null if the MoPub ad object was not passed while calling the requestBid API 
      * @param imAd InMobi ad Object for which the keyword is recieved. In case of nil mpAd, set imAd inside localExtras of mopub 
      *          ad object. Kindly refer intergation document. 
      * @param keyword  keyword derived from the bid received. 
      */ 
      - (void)bidReceivedFor:(nullable id)mpAd andInMobiAd:(id)imAd 
          withTransactionInfo:(NSString*)keyword { 
              //mpAd is null. 
              NSLog(@"Test MP Banner:- bidReceivedFor withTransactionInfo: %@", keyword); 
              IMFacadeWrapper* facadeWrapper = [[IMFacadeWrapper alloc] 
                  initWithMoPubObject:self.mpAdView andInMobiObject:imAd]; 
              [self.mpBanner setKeywords:keyword]; // set keyword 
              self.mpBanner.localExtras = @{kIMABInMobiObjectKey : facadeWrapper}; 
              [self.mpBanner loadAd]; 
              //add mpBanner to the subView. 
      } 
      /** 
      * Notifies Bid fetch is failed with error. 
      * @param ad MoPub ad object passed in requestBid. It can be either MPAdView or MPInterstitialAdController type 
      *          It will be null if the MoPub ad object was not passed while calling the requestBid API 
      * @param error error which caused failure. 
      */ 
      - (void)bidFailedFor:(nullable id)ad withError:(NSError*)error { 
          NSLog(@"Test MP Banner:- bidFailedForAd withError: %@", error); 
      } 
      @end
      		

    Notes :

    The keyword received will be in the format of "bidKeyword": "IMAB:9.00, IMAB:9.10"/ “IMAB:9.00” It’s a passthrough key, kindly add bidKeyword as keyword of MoPub object. The first bid value is the absolute keyword and the second bid keyword is granular keyword.

    Note that the IMAB keyword set to the MoPubView must be cleared off post each ad opportunity and before loading the banner ad again.

    Passing mopub object in facadeWrapper is optional. If mopub object will be passed to IMFacadeWrapper, the keyword removal will be handled.

    Step 3: Setting up for MoPubView refresh

    In case your MoPubView has auto refresh feature enabled, then simply you need to request a bid for every success/failure for callback.

    - (void)adViewDidLoadAd:(MPAdView *)view adSize:(CGSize)adSize { 
    	NSLog(@"-------- MPAdView, adViewDidLoadAd:"); 
    	 [self.abBanner requestBid:self.mpAdView timeout:]; 
    } 
    
    - (void)adView:(MPAdView *)view didFailToLoadAdWithError:(NSError *)error { 
    	NSLog(@"-------- MPAdView, didFailToLoadAdWithError:"); 
    	 [self.abBanner requestBid:self.mpAdView timeout:]; 
    } 
    	

    Interstitial Ads

    Step 1: Setting up and adding an Interstitial Ad to your App

    Creating an Interstitial Ad

    To create an interstitial ad, create an instance of an IMABMoPubInterstitial like so:

    IMABMoPubInterstitial* interstitialAd = [[IMABMoPubInterstitial alloc] initWithPlacementId:<placementID> 
    	delegate:<delegate>];
    	

    Notes:

    • The IMABMoPubInterstitial 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.

    Step 2: Requesting for Bid

    Requesting for a bid requires you to call the IMABMoPubInterstitial: requestBid method on the instance you just created to request for a bid. Note that there are two API(s) available to request for a bid -

    • IMABMoPubInterstitial: -(void)requestBid:(nullable id)ad timeout: (NSTimeInterval) timeout; When you pass a MPInterstitialAdController instance, the InMobi SDK automatically takes care of setting the keyword to this instance and saving the IMInterstitial instance for future usage in CustomEvent class.
      /** 
      * A sample code to request bid with MPInterstitialAdController 
      */ 
      @interface InterstitialViewController () <IMABMoPubDelegate, MPInterstitialAdControllerDelegate> 
      //Hold the instance of IMABMoPubInterstitial, to load an InMobi's ad. 
      @property (strong, nonatomic) MPInterstitialAdController *mpInterstitial; 
      @property (strong, nonatomic) IMABMoPubInterstitial *abInterstitial; 
      @end 
      @implementation InterstitialViewController 
      - (void)loadUABannerAd { 
          // Write code to initialise your MoPub ad object and then do the following 
          self.mpInterstitial = [MPInterstitialAdController interstitialAdControllerForAdUnitId:<adUnitID>]; 
          self.mpInterstitial.delegate = <delegate>; 
          //Create an instance of IMABMoPubInterstitial and call requestBid 
          self.abInterstitial = [[IMABMoPubInterstitial alloc]initWithPlacementId:<placementID> delegate:<delegate>]; 
          [self.abInterstitial requestBid:self.mpInterstitial timeout:<timeout>];
      } 
      #pragma mark - IMABMopubBannerDelegate method
      /** 
      * Notifies Bid is recieved successfully with transaction keyword. 
      * @param mpAd MoPub ad object passed in requestBid. It can be either MPAdView or MPInterstitialAdController type 
      * It will be null if the MoPub ad object was not passed while calling the requestBid API 
      * @param imAd InMobi ad Object for which the keyword is recieved. 
      * In case of nil mpAd, set imAd inside localExtras of mopub 
      * ad object. Kindly refer intergation document. 
      * @param keyword  keyword derived from the bid received. 
      */ 
      - (void)bidRecievedFor:(nullable id)mpAd andInMobiAd:(id)imAd withTransactionInfo:(NSString*)keyword { 
      	//mpAd is null. 
          NSLog(@"Test MP Banner:- bidRecievedFor withTransactionInfo: %@", keyword); 
          [self.mpInterstitial loadAd]; 
      } 
      /** 
      * Notifies Bid fetch is failed with error. 
      * @param ad MoPub ad object passed in requestBid. It can be either MPAdView or MPInterstitialAdController type 
      * It will be null if the MoPub ad object was not passed while calling the requestBid API 
      * @param error error which caused failure. 
      */ 
      - (void)bidFailedFor:(nullable id)ad withError:(NSError*)error {
          NSLog(@"Test MP Banner:- bidFailedForAd withError: %@", error); 
      } 
      @end
      		
    • IMABMoPubInterstitial: -(void)requestBid:(NSTimeInterval)timeout; In case you don’t wish to pass the MPInterstitialAdController instance, then you need to take care of not only setting the keyword to the MPInterstitialAdController instance (for which bid was requested) but also you’ve to pass IMInterstitial instance to CustomEvent for rendering the ad, for that we create an instance of IMFacadeWrapper and add it in the localExtras of MPInterstitialAdController, as mentioned in the following code:
      /** 
      * A sample code to request bid without MPInterstitialAdController 
      */ 
      @interface InterstitialViewController () <IMABMoPubDelegate, 
          MPInterstitialAdControllerDelegate> 
      //Hold the instance of IMABMoPubInterstitial, to load an InMobi's ad. 
      @property (strong, nonatomic) MPInterstitialAdController *mpInterstitial; 
      @property (strong, nonatomic) IMABMoPubInterstitial *abInterstitial; 
      @end 
      @implementation InterstitialViewController 
      - (void)loadUAInterstitialAd { 
          // Write code to initialise your MoPub ad object and then do the following 
          self.mpInterstitial = [MPInterstitialAdController 
              interstitialAdControllerForAdUnitId:<adUnitID>]; 
          self.mpInterstitial.delegate = <delegate>; 
          //Create an instance of IMABMoPubInterstitial and call requestBid 
          self.abInterstitial = [[IMABMoPubInterstitial alloc]
              initWithPlacementId:<placementID> delegate:<delegate>]; 
          [self.abInterstitial requestBid:<timeout>]; 
      } 
      #pragma mark - IMABMopubBannerDelegate method 
      /** 
      * Notifies Bid is recieved successfully with transaction keyword. 
      * @param mpAd MoPub ad object passed in requestBid. It can be either MPAdView or MPInterstitialAdController type 
      *          It will be null if the MoPub ad object was not passed while calling the requestBid API 
      * @param imAd InMobi ad Object for which the keyword is recieved. In case of nil mpAd, set imAd inside localExtras of mopub 
      *          ad object. Kindly refer intergation document. 
      * @param keyword  keyword derived from the bid received. 
      */ 
      - (void)bidReceivedFor:(nullable id)mpAd andInMobiAd:(id)imAd 
          withTransactionInfo:(NSString*)keyword { 
              //mpAd is null. 
              NSLog(@"Test MP Banner:- bidReceivedFor withTransactionInfo: %@", keyword); 
              IMFacadeWrapper* facadeWrapper = [[IMFacadeWrapper alloc] 
                  initWithMoPubObject:self.mpInterstitial andInMobiObject:imAd]; 
              [self.mpInterstitial setKeywords:keyword]; // set keyword 
              self.mpInterstitial.localExtras = @{kIMABInMobiObjectKey : 
                  facadeWrapper}; 
              [self.mpInterstitial loadAd]; 
              //add mpBanner to the subView. 
      } 
      /** 
      * Notifies Bid fetch is failed with error. 
      * @param ad MoPub ad object passed in requestBid. It can be either MPAdView or MPInterstitialAdController type 
      *          It will be null if the MoPub ad object was not passed while calling the requestBid API 
      * @param error error which caused failure. 
      */ 
      - (void)bidFailedFor:(nullable id)ad withError:(NSError*)error { 
          NSLog(@"Test MP Banner:- bidFailedForAd withError: %@", error); 
      } 
      @end
      		

    Notes :

    The keyword received will be in the format of "bidKeyword": "IMAB:9.00, IMAB:9.10"/ “IMAB:9.00” It’s a passthrough key, kindly add bidKeyword as keyword of MoPub object. The first bid value is the absolute keyword and the second bid keyword is granular keyword.

    Note that the IMAB keyword set to the MPInterstitialAdController must be cleared off post each ad opportunity and before loading the banner ad again.

    Passing mopub object in facadeWrapper is optional. If mopub object will be passed to IMFacadeWrapper, the keyword removal will be handled.

    After load success/failure callback, new bid request can be called.

    exchange | Audience Bidding for MoPub (Android)

    Setup

    In order to start setting up, you’ve to ensure that the steps mentioned here have already been incorporated. In addition to these steps, you’ve to add one more library to your project.

    Step 1: Adding the SDK to your Project

    Option 1: Pulling the Latest SDK via JCenter (Recommended)

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

    1. Include JCenter in your top-level build.gradle file
          allprojects {
              repositories {
                  jcenter()
              }
          }
      		
    2. Add the following line to the dependencies element in your application module’s build.gradle.
          implementation 'com.inmobi.monetization:inmobi-mopub-plugin:9.0.7.0'
      		

      Note : If the version is X.Y.Z.A , X.Y.Z denotes the compatible media SDK version whereas A denotes the patch number.

    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])
    	

    Step 2: Integrating MoPub Plugin

    Step 2.1: Audience Bidding

    Note: Contact your account manager for Audience Bidding placement setup.

    To use the InMobi Audience Bidding SDK, here is how you can expect the flow to go:

    • The InMobi Audience Bidder SDK will make an ad request and return a bid token
    • The bid token from the ad network will have an updated MoPub Ad Object and have pricing keywords attached
    • You then call loadAd() on the MoPub ad object as before
    • If InMobi is selected to fill, The InMobi Audience Bidder SDK will handle the rendering
    Step 2.1.1: Enabling Audience Bidding Setup on MoPub

    To enable Audience Bidding, you will need to do 2 things:

    1. Set up the line item to use the specific keywords with pricing used by the IMAudienceBidder class.
    2. Update your existing MoPub implementation.
    Step 2.1.1.1: Setting Up the MoPub Line Items

    Option 1 (Setting up Line Items Manually)

    1. Click on Orders -> Create Order
    2. Create a new order
      • Give your order a name (ex. Audience_Bidding_Test)
      • Enter in an advertiser name (ex. InMobi)
    3. Line item type
      • Give your line item a name (ex.IMAB_Banner_0.50)
      • Select type: Network Line Item
      • Select Network: Custom SDK network
      • Custom event class:
        • Banner: com.inmobi.plugin.mopub.IMABCustomEventBanner
        • Interstitial: com.inmobi.plugin.mopub.IMABCustomEventInterstitial
      • Custom event data: {}
      • Under "Budget & schedule", please enter the rate that matches what you have set up on your InMobi + AerServ dashboard for your eCPM (ex. 0.50)
    4. Ad unit targeting
      • Select the app and ad unit for your line item
    5. Audience Targeting
    Enter the keyword in the "Keyword targeting" in this format IMAB:0.00 (ex. IMAB:0.50)

    eCPM

    Keyword

    eCPM

    Keyword

    0.01 IMAB:0.01 5.00 IMAB:5.00
    0.05 IMAB:0.05 6.00 IMAB:6.00
    0.10 IMAB:0.10 7.00 IMAB:7.00
    0.20 IMAB:0.20 8.00 IMAB:8.00
    0.30 IMAB:0.30 9.00 IMAB:9.00
    0.40 IMAB:0.40 10.00 IMAB:10.00
    0.50 IMAB:0.50 11.00 IMAB:11.00
    0.60 IMAB:0.60 12.00 IMAB:12.00
    0.70 IMAB:0.70 13.00 IMAB:13.00
    0.80 IMAB:0.80 14.00 IMAB:14.00
    0.90 IMAB:0.90 15.00 IMAB:15.00
    1.00 IMAB:1.00 16.00 IMAB:16.00
    1.10 IMAB:1.10 17.00 IMAB:17.00
    1.20 IMAB:1.20 18.00 IMAB:18.00
    1.30 IMAB:1.30 19.00 IMAB:19.00
    1.40 IMAB:1.40 20.00 IMAB:20.00
    1.50 IMAB:1.50 21.00 IMAB:21.00
    1.60 IMAB:1.60 22.00 IMAB:22.00
    1.70 IMAB:1.70 23.00 IMAB:23.00
    1.80 IMAB:1.80 24.00 IMAB:24.00
    1.90 IMAB:1.90 25.00 IMAB:25.00
    2.00 IMAB:2.00 26.00 IMAB:26.00
    2.50 IMAB:2.50 27.00 IMAB:27.00
    3.00 IMAB:3.00 28.00 IMAB:28.00
    3.50 IMAB:3.50 29.00 IMAB:29.00
    4.00 IMAB:4.00 30.00 IMAB:30.00

    Option 2 (Setting up Line Items with an Automated Script)

    Add a Chrome extension to your browser. Download extension here.

    1. Login to the MoPub Dashboard
    2. Create your order
    3. Create the first line item under the order
      • Line Item Setup:
        • Type & Priority: Network Line Item
        • Network: Custom SDK Network
        • Custom Event Class:
          • Banner: com.inmobi.plugin.mopub.IMABCustomEventBanner
          • Interstitial: com.inmobi.plugin.mopub.IMABCustomEventInterstitial
        • Example:

        • Under the "Audience Targeting" section:
          • Please enter a keyword in this format: IMAB:0.01
          • Example:

    4. Staying on the current tab, open the extension.
    5. Input the order name and the first line item name
    6. Click 'Run' to execute
    7. Wait for all the line items to be created

    Banner Ads

    Step 1: Setting up a Banner Ad

    To display a banner ad on your app, you would first need to create a banner placement ID. After adding your app, select BANNER AD to create a placement for the ad type - Banner. Once you create the banner placement, the placement ID is available.

    Step 2: Adding a Banner Ad to your App

    Creating a Banner Ad

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

    IMABMoPubBanner bannerAd = new IMABMoPubBanner(context, <placementID>, <widthInDp>, <heightInDp>, listener);
    	

    Notes:

    • The IMABMoPubBanner 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.

    Step 3: Requesting for Bid

    Requesting for a bid requires you to call the IMABMoPubBanner#requestBid(...) method on the instance you just created to request for a bid. Note that there are two API(s) available to request for a bid -

    • IMABMoPubBanner#requestBid(moPubView, timeoutInMillis) : When you pass a MoPubView instance, the InMobi SDK automatically takes care of setting the keyword to this instance and saving the InMobiBanner instance for future usage in CustomEvent class.
      /**
      * A sample code to request bid with MoPubView
      */
      public class YourActivity {
          private IMABMoPubBanner banner;
          private MoPubView moPubView;
         public void requestBid() {
             // Write code to initialise your MoPub ad object and then do the following
             banner = new IMABMoPubBanner(context, <placementId>, 320, 50, new IMABMoPubListener<MoPubView, InMobiBanner>() {
                 /**
                  * The callback to notify that bid fetch was successful
                  * @param moPubAdObject a MoPub ad object passed in requestBid. It will be null if the MoPub ad object was not passed while calling the requestBid API
                  * @param imAdObject a InMobi ad object.
                  * @param keyword a keyword derived from the bid received.
                 */
                  @Override
                  public void onBidReceived(@Nullable MoPubView moPubAdObject,
                                            @NonNull InMobiBanner inMobiBanner, @NonNull String keyword) {
                      Log.d(TAG, "Keywords received:" + keyword);
                      // Load your MoPub ad here
                  }
                 /**
                  * The callback to notify that bid fetch resulted into failure
                  * @param moPubAdObject a MoPub ad object passed in requestBid.
                  *                      It will be null if the MoPub ad object was not passed while calling the requestBid API
                  * @param error a {@link Error} to inform what went wrong while fetching the bid
                 */
                  @Override
                  public void onBidFailed(@Nullable MoPubView moPubAdObject, @NonNull Error error) {
                      Log.d(TAG, "Bid failure :" + error.getMessage());
                      // Load your MoPub ad here
                  }
             // Requesting for bid, where timeout is 5seconds
             banner.requestBid(moPubView, 5000);
         }
      }
      		
    • IMABMoPubBanner#requestBid(timeoutInMillis) : In case you don’t wish to pass the MoPubView instance, then you need to take care of not only setting the keyword to the MoPubView instance (for which bid was requested) but also you’ve to save the InMobiBanner instance so that you can use it in the CustomEvent for rendering the ad in case InMobi wins the auction. Also, note that the IMAB keyword set to the MoPubView must be cleared off post each ad opportunity and before loading the banner ad again.
      /**
      * A sample code to request bid without MoPubView
      */
      public class YourActivity {
          private IMABMoPubBanner banner;
          private MoPubView moPubView;
         public void requestBid() {
             // Write code to initialise your MoPub ad object and then do the following
             banner = new IMABMoPubBanner(context, <placementId>, 320, 50, new IMABMoPubListener<MoPubView, InMobiBanner>() {
                 /**
                  * The callback to notify that bid fetch was successful
                  * @param moPubAdObject a MoPub ad object passed in requestBid. It will be null if the MoPub ad object was not passed while calling the requestBid API
                  * @param imAdObject a InMobi ad object.
                  * @param keyword a keyword derived from the bid received.
                 */
                  @Override
                  public void onBidReceived(@Nullable MoPubView moPubAdObject,
                                            @NonNull InMobiBanner inMobiBanner, @NonNull String keyword) {
                      Log.d(TAG, "Keywords received:" + keyword);
                      // Since MoPubView has not been passed in the request, you need to do the following
                      String oldKeyword = mopubView.getKeywords();
                      moPubView.setKeywords(TextUtils.isEmpty(oldKeyword) ? keyword :
                          String.format("%s,%s", oldKeyword, keyword));
                      Map<String, Object> localExtras = moPubView.getLocalExtras();
                      localExtras.put(IMABCustomEventBanner.AD_OBJECT_KEY, inMobiBanner);
                      moPubView.setLocalExtras(localExtras);
                      // Load your MoPub ad here
                  }
                 /**
                  * The callback to notify that bid fetch resulted into failure
                  * @param moPubAdObject a MoPub ad object passed in requestBid.
                  *                      It will be null if the MoPub ad object was not passed while calling the requestBid API
                  * @param error a {@link Error} to inform what went wrong while fetching the bid
                 */
                  @Override
                  public void onBidFailed(@Nullable MoPubView moPubAdObject, @NonNull Error error) {
                      Log.d(TAG, "Bid failure :" + error.getMessage());
                      // Load your MoPub ad here
                  }
             // Requesting for bid, where timeout is 5seconds
             banner.requestBid(5000);
         }
      }
      		

    Step 4: Setting up for MoPubView refresh

    In case your MoPubView has auto refresh feature enabled, then simply you need to request a bid for every success/failure for callback, as mentioned below.

    /**
    * A sample code to request bid without MoPubView
    */
    public class YourActivity {
        private IMABMoPubBanner banner;
        private MoPubView moPubView;
        private MoPubView.BannerAdListener bannerAdListener = new MoPubView.BannerAdListener() {
            @Override
            public void onBannerLoaded(MoPubView banner) {
                Log.d(TAG, "Banner loaded");
                // Requesting for bid, where timeout is 5seconds
                banner.requestBid(moPubView, 5000);
            }
            @Override
            public void onBannerFailed(MoPubView banner, MoPubErrorCode errorCode) {
                Log.d(KLOG_TAG, "Banner load failed : " + errorCode.toString());
                // Requesting for bid, where timeout is 5seconds
                banner.requestBid(moPubView, 5000);
            }
        };
        // Other code
    }
    	

    Interstitial Ads

    Step 1: Setting up an Interstitial Ad

    1. To display an Interstitial ad, you need an interstitial placement ID.
    2. After adding your app, select INTERSTITIAL AD to create a placement for ad type Interstitial.
    3. Once you successfully create the placement, the placement ID is available.

    Step 2: Adding an Interstitial Ad to your App

    Creating an Interstitial Ad

    To create an interstitial ad, create an instance of an IMABMoPubInterstitial like so:

    IMABMoPubInterstitial interstitialAd = new IMABMoPubInterstitial(context, <placementID>, listener);
    	

    Notes:

    • The IMABMoPubInterstitial 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.

    Step 3: Requesting for Bid

    Requesting for a bid requires you to call the IMABMoPubInterstitial#requestBid(...) method on the instance you just created to request for a bid. Note that there are two API(s) available to request for a bid -

    • IMABMoPubInterstitial#requestBid(moPubInterstitial, timeoutInMillis) : When you pass a MoPubInterstitial instance, the InMobi SDK automatically takes care of setting the keyword to this instance and saving the InMobiInterstitial instance for future usage in CustomEvent class.
      /**
      * A sample code to request bid with MoPubView
      */
      public class YourActivity {
          private IMABMoPubInterstitial interstitial;
          private MoPubInterstitial moPubInterstitial;
         public void requestBid() {
             // Write code to initialise your MoPub ad object and then do the following
             interstitial = new IMABMoPubInterstitial(context, <placementId>, new IMABMoPubListener<MoPubInterstitial, InMobiInterstitial>() {
                 /**
                  * The callback to notify that bid fetch was successful
                  * @param moPubAdObject a MoPub ad object passed in requestBid. It will be null if the MoPub ad object was not passed while calling the requestBid API
                  * @param imAdObject a InMobi ad object.
                  * @param keyword a keyword derived from the bid received.
                 */
                  @Override
                  public void onBidReceived(@Nullable MoPubInterstitial moPubAdObject,
                                            @NonNull InMobiInterstitial inMobiInterstitial, @NonNull String keyword) {
                      Log.d(TAG, "Keywords received:" + keyword);
                      // Load your MoPub ad here
                  }
                 /**
                  * The callback to notify that bid fetch resulted into failure
                  * @param moPubAdObject a MoPub ad object passed in requestBid.
                  *                      It will be null if the MoPub ad object was not passed while calling the requestBid API
                  * @param error a {@link Error} to inform what went wrong while fetching the bid
                 */
                  @Override
                  public void onBidFailed(@Nullable MoPubInterstitial moPubAdObject, @NonNull Error error) {
                      Log.d(TAG, "Bid failure :" + error.getMessage());
                      // Load your MoPub ad here
                  }
             // Requesting for bid, where timeout is 5seconds
             interstitial.requestBid(moPubInterstitial, 5000);
         }
      }
      		
    • IMABMoPubInterstitial#requestBid(timeoutInMillis) : In case you don’t wish to pass the MoPubView instance, then you need to take care of not only setting the keyword to the MoPubView instance (for which bid was requested) but also you’ve to save the InMobiInterstitial instance so that you can use it in the CustomEvent for rendering the ad in case InMobi wins the auction. Also, note that the IMAB keyword set to the MoPubInterstitial must be cleared off post each ad opportunity and before loading the interstitial ad again.
      /**
      * A sample code to request bid without MoPubView
      */
      public class YourActivity {
          private IMABMoPubInterstitial interstitial;
          private MoPubInterstitial moPubInterstitial;
         public void requestBid() {
             // Write code to initialise your MoPub ad object and then do the following
             interstitial = new IMABMoPubInterstitial(context, <placementId>, new IMABMoPubListener<MoPubInterstitial, InMobiInterstitial>() {
                 /**
                  * The callback to notify that bid fetch was successful
                  * @param moPubAdObject a MoPub ad object passed in requestBid. It will be null if the MoPub ad object was not passed while calling the requestBid API
                  * @param imAdObject a InMobi ad object.
                  * @param keyword a keyword derived from the bid received.
                 */
                  @Override
                  public void onBidReceived(@Nullable MoPubInterstitial moPubAdObject,
                                            @NonNull InMobiInterstitial inMobiInterstitial, @NonNull String keyword) {
                      Log.d(TAG, "Keywords received:" + keyword);
                      // Since MoPubInterstitial has not been passed in the request, you need to do the following
                      String oldKeyword = moPubInterstitial.getKeywords();
                      moPubInterstitial.setKeywords(TextUtils.isEmpty(oldKeyword) ? keyword :
                          String.format("%s,%s", oldKeyword, keyword));
                      Map<String, Object> localExtras = moPubInterstitial.getLocalExtras();
                      localExtras.put(IMABCustomEventInterstitial.AD_OBJECT_KEY, inMobiInterstitial);
                      moPubInterstitial.setLocalExtras(localExtras);
                      // Load your MoPub ad here
                  }
                 /**
                  * The callback to notify that bid fetch resulted into failure
                  * @param moPubAdObject a MoPub ad object passed in requestBid.
                  *                      It will be null if the MoPub ad object was not passed while calling the requestBid API
                  * @param error a {@link Error} to inform what went wrong while fetching the bid
                 */
                  @Override
                  public void onBidFailed(@Nullable MoPubInterstitial moPubAdObject, @NonNull Error error) {
                      Log.d(TAG, "Bid failure :" + error.getMessage());
                      // Load your MoPub ad here
                  }
             // Requesting for bid, where timeout is 5seconds
             interstitial.requestBid(5000);
         }
      }
      		

    exchange | Actions Required By Publishers to Get Paid draft

    Introduction

    Publishers have to perform the following tasks to get paid by InMobi:

    1. Creating and verifying a payment profile
    2. Activating a payment profile

    Step 1: Creating and Verifying a Payment Profile

    • InMobi follows a payout cycle of 60 days. This means that your earnings for a given month will be credited to you at the end of the 60-day payout cycle.
    • You have the option of receiving your payouts via PayPal or wire transfer/RTGS.

    For payments to be made to you, you must add a payment profile to your account. Perform the following steps to specify a valid payment profile:

    Creating a PayPal Profile

    1. Log in to your InMobi account or click here.
    2. Click the drop-down list at the top right of the page, and then select Earnings.
    3. Click the Add Account button.

    4. Select your country of residence from the Select Country drop-down. See A in the screenshot above.
    5. Select PayPal under the Select Mode of Transfer drop-down. See B in the screenshot above.
    6. Enter your PayPal ID. See C in the screenshot above.
    7. Click Verify Now.
    8. You will be redirected to the PayPal login page. Enter your credentials and log in.

    9. After you login, you will be asked if you want to grant permission to InMobi to verify your PayPal payment profile. Click Grant Permission.

    10. Click Return to InMobi to go back to the InMobi Earnings page.

    Creating an Online Bank Transfer Profile

    1. Log in to your InMobi account or click here.
    2. Click the drop-down list at the top right of the page, and then select Earnings.
    3. Click the Add Account button.

    4. Select your country of residence from the Select Country drop-down. See A in the screenshot above.
    5. Select Online Bank Transfer under the Select Mode of Transfer drop-down. See B in the screenshot above.
    6. Enter bank details. See C in the screenshot above.
    7. Check Transfer my earnings to this account and click Add Account.

    Activating your Payment Profile

    To activate your profile, perform the following steps:

    1. Log in to your InMobi account, or click here.
    2. Click the drop-down list on the top right of the page, and then select Earnings.
    3. Click the option Make Active to activate your payment profile.

    Payment Terms

    Payments to publishers will be made in US dollars for all earnings for a publisher account. Payments will not be made at a property (site or app) level. The monthly earnings of a publisher against an account, provided the account qualifies to be paid, will be paid within 60 days of the end of that month. Payment frequency will be monthly.

    For example, publisher earnings in the month of January (January 1 – January 31) will be made in the month of April of the same year.

    Modes and Thresholds to Qualify

    InMobi supports the following payment modes:

    Electronic Funds Transfer to a System-Verified Bank Account

    • InMobi can pay accrued publisher earnings, subject to qualification, by Electronic Funds Transfer. To do this, the details of your bank account where payment is to be received should be verified on the InMobi portal.
    • For bank accounts in countries other than India, to qualify for payments by electronic funds transfer, the accrued unpaid earning need to exceed USD 300.
    • For electronic funds transfers to bank accounts in India, the accrued unpaid earning need to exceed USD 50 to qualify.
    • All unpaid earnings will roll over to the next payment cycle and come up for qualification again. Accrued earnings will again be compared against the minimum amount.

    PayPal Transfer to Verified PayPal Accounts

    • InMobi can pay accrued publisher earnings, subject to qualification, through PayPal. To do this, the PayPal profile where payment is to be received should verified on the InMobi portal.
    • For publishers (outside India), to qualify for payments through PayPal, the accrued unpaid earning needs to exceed USD 50. The minimum threshold to make payments through PayPal is independent of the country in which the PayPal beneficiary resides, or where the profile was created.
    • Publishers from India cannot be paid using PayPal.
    • All unpaid earnings will roll over to the next payment cycle and come up for qualification again, wherein the accrued earnings shall be compared against the minimum amount.

    exchange | Transferring Your Estimated Pending Earnings to Available Funds draft

    Overview

    If you have both advertiser and publisher accounts with InMobi, you can use the earnings from your existing publisher account to run advertising campaigns. To do this, you must transfer a part or all of your publisher earnings to your advertiser account.

    Estimated pending earnings represent the total unpaid, accrued earnings against a publisher's account at any point in time. While this is representative of the accrued earnings, it does not represent the amount the publisher will be paid in a given payment cycle.

    The actual amount paid is subject to the payment period under consideration and corrections, such as prior payments, and adjustments, if any.

    To view your estimated pending earnings,

    1. Log in to your InMobi account, or click here.
    2. Click the drop down list at the top right of the page.
    3. Select Earnings. Your Transaction History and Estimated Pending Earnings will be displayed.

    Transferring your Estimated Pending Earnings

    To transfer funds to your advertiser account, perform the following steps:

    1. Log in to your InMobi account, or click here.
    2. Click the drop down list at the top right of the page.
    3. Select Funds.

    1. Click the Add Funds button.
    2. Select the Move From Earnings option.
    3. Enter the amount you wish to transfer to your advertiser account.
      Note: The maximum amount you can enter here is the value of your current pending earnings.
    4. After the transfer request is processed, you can use these funds to run your advertising campaigns with InMobi.

    exchange | Viewing earnings history draft

    This page shows you all earnings-related transactions made on your account. To view your transaction history, perform these steps:

    1. Log in to your InMobi account, or click here.
    2. Click the drop-down list at the top right of the page, and then click Earnings.
    3. The transaction details are available as shown below:

    Note:
    You can view your transaction history for different periods by selecting different time ranges, either preset or custom.
    You can export your transaction history to a CSV or Excel file by clicking the Export option, circled in red above.

    exchange | iOS Mopub new draft

    Getting Started with iOS Integration

    Integrating and monetizing InMobi SDK with Mopub is easy. Please refer this guide for integration instructions.

    You have access to the following ad types from InMobi via Mopub mediation:

    • Banner
    • Medium - Banner
    • Fullscreen (Interstitial, Full-screen Video Ads)
    • Rewarded Video
    • Native

    Before you begin setting up InMobi as an ad source on Mopub dashboard, it’s important that you create an InMobi account, register your app, configure placements and complete the payment information. You can learn more about it here.

    If you have completed the above steps, they you are all good to begin setting up InMobi as an adsource on Mopub. Let’s begin!

    Step 1: Configuring InMobi as an Ad Source on MoPub’s Dashboard

    Log on to your MoPub account and identify the ad units that you wish to monetize via InMobi. Then, navigate to the Networks tab.

    1. To monetize via InMobi, select Custom SDK Network. It allows you to integrate InMobi via MoPub with plug-n-play “Custom Events”.

      Note: You need both the InMobi SDK and the custom event for successful integration.

    2. Navigate to the specific ad unit that you want to monetize via InMobi.

    3. Enter the name of InMobi custom event class specific for that particular ad format as Custom Event Class value. For example, Interstitial Ad - the custom event is called: “com.inmobi.showcase.InMobiInterstitialCustomEvent”.

      Use fully qualified Custom Event class names. Here is the complete grid for custom events by ad unit type:

      Ad Unit

      Class Name

      Banner

      <your_package_name>.InMobiBannerCustomEvent

      Medium (300x250 banner)

      <your_package_name>.InMobiBannerCustomEvent

      Fullscreen

      <your_package_name>.InMobiInterstitialCustomEvent

      Rewarded Video

      <your_package_name>.InMobiRewardedCustomEvent

      Native

      <your_package_name>.InMobiNativeCustomEvent/

      <your_package_name>.InMobiNativeStrandCustomEvent

      Note: Please note that the package name <your_package_name> should be replaced with the actual package name in which the custom event classes are placed in the app.

    4. Your account ID is available in your InMobi account as illustrated in the screenshot below.

    5. Placement ID is present under the placements section as illustrated in the screenshot below.

    6. Enter the Account ID and the Placement ID in the following format in the placeholder for Custom Event Class Data.

      {“placementid”: “<Enter your InMobi Placement ID here>”,”accountid”:”<Enter your InMobi Account ID here>”}

      A sample input will look like this:
      {“placementid”:”1468850508657”,”accountid”:”2072131215e04a5ea20e25ffec1a7171”}

    Step 2: Adding the InMobi SDK and CustomEvent to Your Project

    Integrating the InMobi SDK and the custom event to your project is fairly seamless. But before we begin, let’s pause for some checks:

    Important Prerequisites:

    Checkpoint 1: Preparing your App for iOS 10

    App Transport Security (ATS), a default setting introduced with iOS 9 that mandates apps to make network connections only over TLS version 1.2 and later. Though InMobi is committed towards the adoption of HTTPS, the current setup requires our demand partners to support this change and be 100% compliant with all the requirements of ATS.

    While we work with our partners progressing towards a secure environment, to ensure ads work on iOS 9 and later versions, you need to follow these steps as a near-term fix:

    • Disable ATS (Recommended) - to ensure non-secure content from the partners work correctly in your updated apps. To disable ATS flag, add the following code snippet to your app's Info.plist.

      <key>NSAppTransportSecurity</key>
      <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
      </dict>
            
    • Disable ATS with exceptions (Not Recommended) - in case you plan to migrate towards ATS compliance. You can achieve so by allowing secure content from your domains by adding them on the exception list.
      <key>NSAppTransportSecurity</key>
            <dict>
               <key>NSAllowsArbitraryLoads</key>
             <true/>
                <key>NSExceptionDomains</key>
                 <dict>
                       <key>example.com</key>
                     <dict>
                           <key>NSIncludesSubdomains</key>
                           <true/>
                       </dict>
                  </dict>
      </dict>
            

    Remember: Refrain from using InMobi domains and CDN in the exception list as it will result in errors during the runtime.

    App Store Review

    If ATS is not disabled for apps, monetization will be impacted on devices running iOS 9+. The demand ecosystem has yet to migrate to SSL enabled world, causing ads not to render. The ATS disablement will trigger additional App Store review for your app, and requires you to provide justification. A sample of justification for consideration:

    For monetization must support serving ads from the advertisers that do not support secure connections.

    Checkpoint 2: iOS 12 WiFi Settings

    Apple has introduced privacy settings to access WiFi details from iOS 12 onwards. To boost monetization and relevant user experience we encourage sharing WiFi details for targeted advertising.

    1. Enable ‘Access WiFi Information’ on your App ID.

    2. Enable access ‘Access WiFi Information’ for your target app from XCode capabilities.

    3. Ensure WiFi Access is added to your App.entitlements file.

    Step 3: Adding the InMobi SDK to Your Project

    Option 1: Integration via Cocoapods

    1. If you are not already using Cocoapods, go to your Xcode project directory and create a pod file using the command below.
        pod init
            
    2. Add the following to Podfile.
        pod 'InMobiSDK'
            
    3. Once you have added it to the pod file, run the command below to complete the task for dependency. You now have a workspace with the pods.
        pod install
            

    Option 2: Integrating the framework directly

    Alternatively, you can integrate the framework directly.

    1. Add the following MANDATORY frameworks to your Xcode project:
      • InMobiSDK.framework from the downloaded InMobi iOS SDK bundle
      • libsqlite3.0.tbd
      • libz.tbd
      • WebKit.framework

    2. Add -ObjC flag to the Other Linker Flags:
      • Open your project in Xcode.
      • Select Application Target > Build Settings.
      • In the Search box, search for Other Linker Flags.
      • Add the -ObjC flag

      Note: Do not remove window property from the AppDelegate.h file as it may lead to an undefined behavior.

    Step 3.1: Add the Custom Event

    Add the custom events to your MoPub project. The custom events for different ad formats are available as part of the sample code available here .

    Code Steps

    The code steps remain the same as they are for regular MoPub integration for fetching and loading an ad. Use the regular MoPub “ad unit id” to request and fetch an ad.

    Step 3.2 Passing user consent information to InMobi SDK

    The publishers monetizing in EEA+UK+Switzerland region will have to pass user consent to InMobi SDK. The publishers can use consent gathering mechanism of their choice, and they will have to pass on this consent information to InMobi.

    • Copy the InMobiGDPR class file from InMobiAdapter folder, into your project.

    • Use [InmobiGDPR grantConsent] or [InmobiGDPR revokeConsent] APIs to pass on user consent. Publisher will have to grant or revoke consent based on the consent provided by the user. It should be called once every session. In case grantConsent() is not called, we will presume that consent is not available for users belonging to EEA+UK+Switzerland region.
    • If the user consent is revoked at any point of time, the publisher has to call [InmobiGDPR revokeConsent] to notify InMobi about the same.
    • Use [InMobiGDPR isGDPRApplicable: (bool) flag ] to let InMobi know whether user belongs to GDPR compliant region.

    More Information

    You can see the complete sample code and example here

    The latest documentation and code samples for the MoPub SDK are available here.

    Step 4: Testing the Integration

    To ensure Mopub SDK relays the ad request to InMobi for testing, you can do the following.

    1. Set manual Ad network optimization for every network including MoPub.
    2. Set manual eCPM floors for all networks keeping the eCPM floor for InMobi higher than other networks, this will ensure that the ad request gets relayed to InMobi for testing. For example for InMobi set the floor to $5 while MoPub marketplace is set to $0.05.


    Step 4.1: Enabling Key SDK Logs

    Enable debug logs by adding following to didFinishLaunchingWithOptions method within the app delegate's .m file, as shown below:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {    
    [IMSdk setLogLevel:kIMSDKLogLevelDebug]; 
    //Initialize InMobi SDK with your account ID
    [IMSdk initWithAccountID:@"Insert InMobi account ID here"];
    //Set log level to Debug
      // Do your stuff.
      return YES;
    }
        

    You can also use the feedback available on the diagnostics tab in the InMobi dashboard (for ad unit and ad request).

    ">

    Step 5: Advanced Configurations

    Pass the location information 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, modify the Custom Event class for your ad-unit to pass on the data using the InMobi SDK API. Please see sample code for more details.

    InMobi supports the following parameters:

    Method Name

    Value

    Description

    setAgeGroup:

    kIMSDKAgeGroupBelow18,

    kIMSDKAgeGroupBetween18And24

    kIMSDKAgeGroupBetween25And29

    kIMSDKAgeGroupBetween30And34

    kIMSDKAgeGroupBetween35And44

    kIMSDKAgeGroupBetween45And54

    kIMSDKAgeGroupBetween55And65

    kIMSDKAgeGroupAbove65

    The age group of the user

    setLocation:

    CLLocation object

    Setting up demographic parameters

    Here is a sample for setting up the InMobi SDK Demographic params. Publishers are requested to set the values of params as they want:

    [IMSDK setAgeGroup:kIMSDKAgeGroupBetween18And24];
    [IMSdk setGender:kIMSDKGenderMale];
        

    Audio Handling in WKWebView

    For publishers running any audio or video media as the main content, we recommend listening to interruptions by observing AVAudioSessionInterruptionnotification posted by AVAudioSession. This will help preempt any content interruptions and help address user experience issues upfront. For more information read these Apple documents: Article 1, Article 2

    Note: In case you want to write your own custom event class to integrate InMobi via MoPub please see here

    exchange | Android Admob new draft

    Getting Started with Android Integration

    Integrating and monetizing InMobi SDK with AdMob is easy. Please refer this guide for integration instructions.

    You have access to the following ad types from InMobi via AdMob mediation:

    • Banner
    • Interstitial (Static Interstitial and Full-screen Video Ads)
    • Rewarded Interstitial
    • Native

    Before you begin setting up InMobi as an ad source on AdMob dashboard, it’s important that you create an InMobi account, register your app, configure placements and complete the payment information. You can learn more about it here.

    If you have completed the above steps, then you are all good to begin setting up InMobi as an adsource on AdMob. Let’s begin!

    Step 1: Configuring InMobi as an Ad Source on AdMob Dashboard

    Logon to your AdMob account and navigate to the specific ad-unit that you want to monetize via the InMobi SDK. Under mediation, navigate to “ad-sources” (if you have integrated solely with AdMob, number of ad sources will be one).

    1. Select new ad network and add InMobi as ad source

    2. In the Network Settings page for InMobi, insert your InMobi account ID and placement ID.

      Your account ID is available in your InMobi account as illustrated in the screenshot below.

      Your Placement ID is present under the placement section in the InMobi dashboard, as illustrated in the screenshot below.

    3. Setting up Ad network optimization: For automatic eCPM optimization, the publisher must provide his/her InMobi reporting API credentials in the AdMob UI. If you want to find your API credentials, go to Account settings->API Key-> Generate Key. Reach out to InMobi support in case you face any issues.


    Step 1.1. Setting up Rewarded Interstitials
    • You can configure the reward either on AdMob’s dashboard or on InMobi’s dashboard.

    • To configure the same on InMobi’s dashboard, choose “Use third-party ad network settings”.

    • Fill in the key-value pair for the reward details, which the InMobi SDK will honour once the user completes watching the video. AdMob will in turn pass this back in the reward callback. For example, you could fill in the following reward details:

    Key = Coins, Value = 1000

    Note: While setting up the rewards on InMobi dashboard, please make sure the reward value is in the form of Integer.


    Step 1.2. Setting up Native Ads

    When creating a native content placement type on the InMobi dashboard to support a native ad unit on AdMob’s dashboard, ensure you don’t change the key names on InMobi dashboard. This is to ensure that the InMobi integration works seamlessly on native ad formats.

    Remember:

    • InMobi Adapter doesn’t honor shouldRequestMultipleImages flag for Native Ads in AdMob SDK.
    • InMobi Adapter also doesn’t honor getImageOrientation/preferredImageOrientation flag in AdMob SDK.

    Step 2: Adding the SDK to your Project

    Option 1: Pulling the Latest SDK via JCenter

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

    1. Include JCenter in your top-level build.gradle file
      allprojects {
          repositories {
              jcenter()
          }
      }
            
    2. Add the following line to the dependencies element in your application module’s build.gradle.
      implementation 'com.inmobi.monetization:inmobi-ads:9.0.0'
            
    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

    Alternately, 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])
        

    Step 2: Adding and Verifying the Dependencies

    To monetize with the InMobi Ad 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 lines 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.0.0'
            
    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 'com.android.support:customtabs:28.0.0'
            
    2. Sync your Gradle project to ensure dependencies are included.
    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.

    Note: 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 do so, add the following line to the application module’s dependency element in the Gradle build script.

                implementation '<strong>com.android.support:support-v4:28.0.0</strong>'
        
    RecyclerView

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

    To do so, add the following line to the application module’s dependency element in the Gradle build script.

                implementation '<strong>com.android.support:recyclerview-v7:27.1.0</strong>'
        

    Note: 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 mark your application as multidex enabled:
          defaultConfig {
                  applicationId "com.inmobi.samples"
                  minSdkVersion 15
                  targetSdkVersion 29 
                  versionCode 1
                  versionName "1.0.0"
                  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 'com.android.support:multidex:1.0.3'
            

    Step 2.1: 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 AVID classes
    -keep class com.integralads.avid.library.* {*;}
        

    Important Prerequisites:

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

    Checkpoint 1: Preparing Your App for Android 10

    InMobi SDK is compatible with Android 10 (API level 29), the latest version of the Android platform.

    On Android P onwards, apps make connections over HTTPS by default. Though InMobi supports the adoption of HTTPS, the current setup requires our demand partners to support HTTPS as well. The publisher can change their settings to HTTP if it has an impact on the revenue potential.

    Checkpoint 2: Preparing Your App for AndroidX

    InMobi SDK is compatible with AndroidX (JetPack) library. In case your app uses the AndroidX library, then 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.

    Step 2.3: Adding the InMobi Adapter to Your Project

    Download the adapter from here. Add the InMobi adapter to your Android Studio project.

    Code Steps

    The code steps remain the same as they are for regular AdMob integration for fetching and loading an ad. Use the AdMob account ID to initialize the AdMob SDK and AdMob “ad unit id” to request and fetch an ad.

    Step 2.4 Passing user consent information to InMobi SDK

    The publishers monetizing in EEA region will have to pass user consent to InMobi SDK. The publishers can use consent gathering mechanism of their choice (like Consent SDK ), and they will have to pass on this consent information to InMobi. To pass consent information, the publisher has to call: InMobiConsent.updateGDPRConsent( consentObj )

    The consentObj will be a JSON object with the following keys:

    Key

    Type

    Inference

    gdpr_consent_available

    boolean

    "true" raspberryublisher 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.

    gdpr

    Number

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

    More Information

    Please download the sample code from here.

    The latest documentation and code samples for the AdMob SDK are available here.

    Step 3: Testing the Integration

    To ensure AdMob SDK relays the ad request to InMobi for testing, you can do the following.

    1. Set manual Ad network optimization for every network including AdMob. Uncheck the “Ad network optimization” checkbox.
    2. Set manual eCPM floors for all networks keeping the eCPM floor for InMobi higher than other networks, this will ensure that the ad request gets relayed to InMobi for testing. In the example below, InMobi floor is set to $5 and AdMob is set to $0.01.

    After performing the steps mentioned above, you can test and relay the requests to InMobi SDK for ad loads.


    Step 3.1 Enabling Key SDK Logs

    You can enable key SDK logs by adding the following line to your Activity where you are integrating the ad-units.

    InMobiSdk.setLogLevel(LogLevel.DEBUG);
        

    You can also leverage feedback available on the diagnostics tab on the ad unit and ad request if you have enabled “Test Mode” on InMobi portal.

    <

    Step 4: Advanced Configurations

    Providing Location and Demographics Data

    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 in the mediation ad request object by calling the setLocation() API of MediationAdRequest class of the Admob SDK.

    InMobi supports passing the following user demographic parameters:

    Key Name

    Value

    Description

    InMobiNetworkKeys.AGE_GROUP

    InMobiNetworkValues.ABOVE_55,

    InMobiNetworkValues.BELOW_18,

    InMobiNetworkValues.BETWEEN_18_AND_20,

    InMobiNetworkValues.BETWEEN_25_AND_34,

    InMobiNetworkValues.BETWEEN_35_AND_54,

    InMobiNetworkValues.BETWEEN_21_AND_24

    The age group of the user

    InMobiNetworkKeys.EDUCATION

    InMobiNetworkValues.EDUCATION_HIGHSCHOOLORLESS,

    InMobiNetworkValues.EDUCATION_COLLEGEORGRADUATE,

    InMobiNetworkValues.EDUCATION_POSTGRADUATEORABOVE

    The education level

    • High school, or less
    • College, or graduate
    • Postgraduate, or above

    InMobiNetworkKeys.AGE

    Any String

    The age of the user

    InMobiNetworkKeys.INTERESTS

    Any String

    Any additional relevant description of the user, or their preferences, separated by commas. Valid acceptable values are mentioned below

    InMobiNetworkKeys.POSTAL_CODE

    Any String

    The postal code (usually a 5 digit number)

    InMobiNetworkKeys.AREA_CODE

    Any String

    The area code (part of the telephone number)

    InMobiNetworkKeys.LANGUAGE

    Any String

    The native language of the user (if known)

    InMobiNetworkKeys.CITY

    Any String

    City

    InMobiNetworkKeys.STATE

    Any String

    State

    InMobiNetworkKeys.COUNTRY

    Any String

    Country

    InMobiNetworkKeys.LOGLEVEL

    InMobiNetworkValues.LOGLEVEL_NONE,

    InMobiNetworkValues.LOGLEVEL_DEBUG,

    InMobiNetworkValues.LOGLEVEL_ERROR

    Log level for InMobi SDK

    exchange | iOS Admob new draft

    Getting Started with iOS Integration

    Integrating and monetizing InMobi SDK with AdMob is easy. Please refer this guide for integration instructions.

    You have access to the following ad types from InMobi via AdMob mediation:

    • Banner
    • Interstitial (Static Interstitial and Full-screen Video Ads)
    • Rewarded Interstitial
    • Native

    Before you begin setting up InMobi as an ad source on AdMob dashboard, it’s important that you create an InMobi account, register your app, configure placements and complete the payment information. You can learn more about it here.

    If you have completed the above steps, then you are all good to begin setting up InMobi as an adsource on AdMob. Let’s begin!

    Step 1: Configuring InMobi as an Ad Source on AdMob Dashboard

    Logon to your AdMob account and navigate to the specific ad-unit that you want to monetize via the InMobi SDK. Under mediation, navigate to “ad-sources” (if you have integrated solely with AdMob, number of ad sources will be one).

    1. Select new ad network and add InMobi as ad source

    2. In the Network Settings page for InMobi, insert your InMobi account ID and placement ID.

      Your account ID is available in your InMobi account as illustrated in the screenshot below.

      Your Placement ID is present under the placement section in the InMobi dashboard, as illustrated in the screenshot below.

    3. Setting up Ad network optimization: For automatic eCPM optimization, the publisher must provide his/her InMobi reporting API credentials in the AdMob UI. If you want to find your API credentials, go to Account settings->API Key-> Generate Key. Reach out to InMobi support in case you face any issues.


    Step 1.1. Setting up Rewarded Interstitials
    • You can configure the reward either on AdMob’s dashboard or on InMobi’s dashboard.

    • To configure the same on InMobi’s dashboard, choose “Use third-party ad network settings”.

    • Fill in the key-value pair for the reward details, which the InMobi SDK will honour once the user completes watching the video. AdMob will in turn pass this back in the reward callback. For example, you could fill in the following reward details:

    Key = Coins, Value = 1000

    Note: While setting up the rewards on InMobi dashboard, please make sure the reward value is in the form of Integer.


    Step 1.2. Setting up Native Ads

    When creating a native content placement type on the InMobi dashboard to support a native ad unit on AdMob’s dashboard, ensure you don’t change the key names on InMobi dashboard. This is to ensure that the InMobi integration works seamlessly on native ad formats.

    Remember:

    • InMobi Adapter doesn’t honor shouldRequestMultipleImages flag for Native Ads in AdMob SDK.
    • InMobi Adapter also doesn’t honor getImageOrientation/preferredImageOrientation flag in AdMob SDK.

    Step 2: Integrating InMobi SDK via AdMob Adapter

    Integrating the InMobi SDK and the AdMob Adapter is fairly seamless. To get an ad from InMobi, you need to incorporate both InMobi SDK and the Adapter. But before we begin, let’s pause for some checks:

    Important Prerequisites:

    Checkpoint 1: Preparing your App for iOS 10

    App Transport Security (ATS), a default setting introduced with iOS 9 that mandates apps to make network connections only over TLS version 1.2 and later. Though InMobi is committed towards the adoption of HTTPS, the current setup requires our demand partners to support this change and be 100% compliant with all the requirements of ATS.

    While we work with our partners progressing towards a secure environment, to ensure ads work on iOS 9 and later versions, you need to follow these steps as a near-term fix:

    • Disable ATS (Recommended) - to ensure non-secure content from the partners work correctly in your updated apps. To disable ATS flag, add the following code snippet to your app's Info.plist.

        <key>NSAppTransportSecurity</key><br>
        <dict><br>
        <key>NSAllowsArbitraryLoads</key><br>
        <true/><br>
        </dict>
            
    • Disable ATS with exceptions (Not Recommended) - in case you plan to migrate towards ATS compliance. You can achieve so by allowing secure content from your domains by adding them on the exception list.
      <key>NSAppTransportSecurity</key>
            <dict>
               <key>NSAllowsArbitraryLoads</key>
             <true/>
                <key>NSExceptionDomains</key>
                 <dict>
                       <key>example.com</key>
                     <dict>
                           <key>NSIncludesSubdomains</key>
                           <true/>
                       </dict>
                  </dict>
      </dict>
            

    Remember: Refrain from using InMobi domains and CDN in the exception list as it will result in errors during the runtime.

    Checkpoint 2: iOS 12 WiFi Settings

    Apple has introduced privacy settings to access WiFi details from iOS 12 onwards. To boost monetization and relevant user experience we encourage sharing WiFi details for targeted advertising.

    1. Enable ‘Access WiFi Information’ on your App ID.

    2. Enable access ‘Access WiFi Information’ for your target app from XCode capabilities.

    3. Ensure WiFi Access is added to your App.entitlements file.

    Step 3: Adding the InMobi SDK to Your Project

    Option 1: Integration via Cocoapods

    1. If you are not already using Cocoapods, go to your Xcode project directory and create a pod file using the command below.
      pod init
            
    2. Add the following to Podfile.
      pod 'InMobiSDK'
            
    3. Once you have added it to the pod file, run the command below to complete the task for dependency. You now have a workspace with the pods.
      pod install
            

    Option 2: Integrating the framework directly

    Alternatively, you can integrate the framework directly.

    1. Add the following MANDATORY frameworks to your Xcode project:
      • InMobiSDK.framework from the downloaded InMobi iOS SDK bundle
      • libsqlite3.0.tbd
      • libz.tbd
      • WebKit.framework

    2. Add -ObjC flag to the Other Linker Flags:
      • Open your project in Xcode.
      • Select Application Target > Build Settings.
      • In the Search box, search for Other Linker Flags.
      • Add the -ObjC flag

    Step 3.1: Adding the InMobi Adapter to Your Project

    Download the adapter from here. Add the InMobi adapter bundle to your Xcode project.

    Code Steps

    The code steps remain the same as they are for regular AdMob integration for fetching and loading an ad. Use the AdMob account ID to initialize the AdMob SDK and AdMob “ad unit id” to request and fetch an ad.

    Note: Do not remove window property from the AppDelegate.h file as it may lead to an undefined behavior.

    Step 3.2 Passing user consent information to InMobi SDK

    The publishers monetizing in EEA region will have to pass user consent to InMobi SDK. The publishers can use consent gathering mechanism of their choice (like Consent SDK ), and they will have to pass on this consent information to InMobi. To pass consent information, the publisher has to call: [GADMInMobiConsent updateGDPRConsent:consentObj];

    The consentObj will be a JSON object with the following keys

    Key

    Type

    Inference

    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.

    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.

    More Information

    Please download the sample code from here.

    The latest documentation and code samples for the AdMob SDK are available here.

    Step 4: Testing the Integration

    To ensure AdMob SDK relays the ad request to InMobi for testing, you can do the following.

    1. Set manual Ad network optimization for every network including AdMob. Uncheck the “Ad network optimization” checkbox.
    2. Set manual eCPM floors for all networks keeping the eCPM floor for InMobi higher than other networks, this will ensure that the ad request gets relayed to InMobi for testing. In the example below, InMobi floor is set to $5 and AdMob is set to $0.01.

    Once you have completed the above steps, you can test and relay the requests to InMobi SDK for ad loads.


    Step 4.1 Enabling Key SDK Logs

    Enable debug logs by adding following to didFinishLaunchingWithOptions method within the app delegate's .m file, as shown below:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {    
      //Initialize InMobi SDK with your account ID
    [IMSdk initWithAccountID:@"Insert InMobi account ID here"];
    //Set log level to Debug
    [IMSdk setLogLevel:kIMSDKLogLevelDebug]; 
      // Do your stuff.
      return YES;
    }
        

    You can also use the feedback available on the diagnostics tab in the InMobi dashboard (for ad unit and ad request).

    Step 5: Advanced Configurations

    Providing Location and Demographics Data

    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: Location can be passed using following method under GADInMobiExtras.h.

      - (void)setLocation:(CLLocation*)location;
        

    All non-context specific parameters can be passed to InMobi for richer ad targeting. Please ensure that you pass on the values for the fields which you collect, and have user consent to share this data. Class "GADInMobiExtras" provides methods to set demographic information about the user.

    InMobi supports the following parameters:

    Method Name

    Value

    Description

    setAgeGroup

    kIMSDKAgeGroupBelow18

    kIMSDKAgeGroupBetween18And24

    kIMSDKAgeGroupBetween25And29

    kIMSDKAgeGroupBetween30And34

    kIMSDKAgeGroupBetween35And44

    kIMSDKAgeGroupBetween45And54

    kIMSDKAgeGroupBetween55And65

    kIMSDKAgeGroupAbove65

    The age group of the user

    setEducationType

    kIMSDKEducationHighSchoolOrLess kIMSDKEducationCollegeOrGraduate kIMSDKEducationPostGraduateOrAbove



    The education level

    • High school, or less
    • College, or graduate
    • Postgraduate, or above

    setAge

    Integer

    The age of the user

    setInterests

    Any String

    Any additional relevant description of the user, or their preferences, separated by commas. Valid acceptable values are mentioned below

    setPostalCode

    Any String

    The postal code (usually a 5 digit number)

    setAreaCode

    Any String

    The area code (part of the telephone number)

    setLanguage

    Any String

    The native language of the user (if known)

    setLocationWithCityStateCountry

    Any String

    Sets location with City, State, Country being passed

    setKeywords

    Any String

    Keywords to be passed in the ad request

    Setting up demographic params

    Here is a sample for setting up the InMobi SDK Demographic params. Publishers are requested to set the values of params as they want:

    InMobiSdk.setAreaCode("080");
    InMobiSdk.setEducation(Education.HIGH_SCHOOL_OR_LESS);
    InMobiSdk.setGender(Gender.MALE);
    InMobiSdk.setAge(23);
    InMobiSdk.setPostalCode("122009");
    InMobiSdk.setLogLevel(LogLevel.DEBUG);
    InMobiSdk.setLocationWithCityStateCountry("blore", "kar", "india");
    InMobiSdk.setLanguage("ENG");
    InMobiSdk.setInterests("dance");
    InMobiSdk.setYearOfBirth(1980);
        

    Audio Handling in WKWebView

    For publishers running any audio or video media as the main content, we recommend listening to interruptions by observing AVAudioSessionInterruptionnotification posted by AVAudioSession. This will help preempt any content interruptions and help address user experience issues upfront. For more information read these Apple documents: Article 1, Article 2

    exchange | 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 on all the important changes on InMobi SDK that impact our publishers.

    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.

    exchange | iOS 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.0.7 [24/Apr/2020]

    Change log for Monetisation SDK

    - Added MAX Header Bidding Support

    - Added MoPub Audience Bidding Support

    - Added Custom Audience Bidding Support

    - New APIs Added

    • IMBannerDelegate:
      -(void)banner:(IMBanner*)banner gotSignals:(NSData*)signals;
      -(void)banner:(IMBanner *)banner failedToGetSignalsWithError:(IMRequestStatus*)status;
      -(void)banner:(IMBanner*)banner didReceiveWithMetaInfo:(IMAdMetaInfo*)info;
      -(void)banner:(IMBanner*)banner didFailToReceiveWithError:(IMRequestStatus*)error;
    • IMInterstitialDelegate:
      -(void)interstitial:(IMInterstitial*)interstitial gotSignals:(NSData*)signals;
      -(void)interstitial:(IMInterstitial*)interstitial failedToGetSignalsWithError:(IMRequestStatus*)status;
      -(void)interstitial:(IMInterstitial*)interstitial didReceiveWithMetaInfo:(IMAdMetaInfo*)metaInfo;
      -(void)interstitial:(IMInterstitial*)interstitial didFailToReceiveWithError:(NSError*)error;
    • IMBannerPreloadManager:
      -(void)preload;
      -(void)load;
    • IMInterstitialPreloadManager:
      -(void)preload;
      -(void)load;

    - New Property "preloadManager" is added in IMBanner and IMInterstitial to enable functionality of IMBannerPreloadManager and IMInterstitialPreloadManager respectively

    - APIs Deprecated

    • IMInterstitialDelegate:
      -(void)interstitialDidReceiveAd:(IMInterstitial*)interstitial;

    Change log for Audience Bidding SDK

    - Added Audience Bidding Support.

    - New classes added:

    • IMABMoPubBanner:
      - (instancetype)initWithFrame:(CGRect)frame placementId:(long long)placementId delegate:(id)delegate;
      - (void)requestBid:(NSTimeInterval)timeout;
      - (void)requestBid:(nullable id)ad timeout:(NSTimeInterval)timeout;
    • IMABMoPubInterstitial:
      - (instancetype)initWithPlacementId:(long long)placementId delegate:(id)delegate;
      - (void)requestBid:(NSTimeInterval)timeout;
      - (void)requestBid:(nullable id)ad timeout:(NSTimeInterval)timeout;
    • IMABMoPubDelegate:
      - (void)bidRecievedFor:(nullable id)mpAd andInMobiAd:(id)imAd withTransactionInfo:(NSString*)keyword;
      - (void)bidFailedFor:(nullable id)ad withError:(NSError*)error;
    • IMFacadeObjectHolder:
      - (instancetype)initWithMoPubObject:(nullable id)mpAd andInMobiObject:(id)imAd;

    Build 9.0.6 [03/Mar/2020]

    - APIs Deprecated

    • - +(void)initWithAccountID:(NSString*)accountID consentDictionary:(nullable NSDictionary*) consentDictionary andError:(NSError * _Nullable * _Nonnull)error;
    • - +(void)initWithAccountID:(NSString *)accountID andError:(NSError * _Nullable * _Nonnull)error;

    - APIs Added

    • + +(void)initWithAccountID:(NSString*)accountID andCompletionHandler:(void (^ _Nullable)( NSError * _Nullable )) completionBlock;
    • + +(void)initWithAccountID:(NSString*)accountID consentDictionary:(nullable NSDictionary*) consentDictionary andCompletionHandler:(void (^ _Nullable)( NSError * _Nullable )) completionBlock;

    - Bug Fixes


    Build 9.0.4 [21/Jan/2020]

    - Deprecated initWithAccountID:consentDictionary: api of IMSdk.

    - Added initWithAccountID:consentDictionary:andError: api to IMSdk.

    - Video support for Banner ad

    - Improvement of fraud detection behaviour.

    - Support for Applovin(9.11.1), MoPub(5.10.0), AdColony(4.1.0), Vungle(6.4.11), Facebook (5.6.0)

    - Bug Fixes


    Build 9.0.3 [10/Dec/2019]

    - Bug Fixes


    Build 9.0.2 [20/Nov/2019]

    - Added ability to compile SDK on Xcode 10.2 onwards

    - Bug Fixes


    Build 9.0.1 [25/Oct/2019]

    - Added support for IAB GDPR consent string

    - Updated OMSDK to v1.2.19

    - Seperated Moat SDK from InMobi SDK and added it as an optional dependency

    - Removed UIWebView from the SDK

    - Bug Fixes


    Build 9.0.0 [20/Sept/2019]

    - Changes to support iOS 13

    - New and improved Modularised SDK design

    - Add InMobiMediationSDK.framework to your project for AerServ Mediation.

    - Addressing issue with layering of FAN banners upon refresh

    - SKStoreProductViewController crash fix.

    - Removed Support for iOS 8.

    - Removed Support for AerServ Native ad format.

    - Removed UIWebView from InMobi SDK. Viewability Partners might be using it.

    - Size reduction for both Framework and ipa inflation.

    - Various Bug Fixes and performance improvements

    - Adapter updates for the following mediation partners:

    • MoPub - v5.9.0
    • Google Mobile Ads - v7.50.0

    - APIs Added

    • IMBanner Class + -(void)cancel;
    • IMInterstitial Class + -(void)cancel;
    - APIs Added
    • ASAdView Class
      - @property (nonatomic, assign) ASEnvironmentType env;
      - @property (nonatomic, assign) ASPlatformType platform;
      - @property (nonatomic, assign) BOOL isMuted;
      - @property (nonatomic, assign) BOOL outlineAd;
      - @property (nonatomic, assign) BOOL sizeAdToFit;
      - @property (nonatomic, assign) BOOL useHeaderBidding;
      - @property (nonatomic, strong) NSArray* keyWords;
      - @property (nonatomic, assign) BOOL allowAdvertiserCloseButton;
      - -(void)forceRefreshAd;
      - -(CGSize)adContentSize;
      - -(void)rotateToOrientation:(UIInterfaceOrientation)newOrientation;
      - -(void)play;
      - -(void)pause;

    • ASAdViewDelegate Protocol
      - -(void)willLeaveApplicatonFromAd:(ASAdView*)adView;
      - -(void)adSizeChanged:(ASAdView*)adView;
      - -(void)adView:(ASAdView*)adView didFireAdvertiserEventWithMessage:(NSString*)msg;

    • ASInterstitialViewController Class
      - @property (nonatomic, assign) ASEnvironmentType env;
      - @property (nonatomic, assign) ASPlatformType platform;
      - @property (nonatomic, assign) BOOL isMuted;
      - @property (nonatomic, assign) BOOL showOutline;
      - @property (nonatomic, assign) BOOL useHeaderBidding;
      - -(void)play;
      - -(void)pause;
    • ASInterstitialViewControllerDelegate Protocol
      - -(void)interstitialViewControllerAdInteraction:(ASInterstitialViewController*)viewController;
      - -(void)interstitialViewController:(ASInterstitialViewController*)viewController didFireAdvertiserEventWithMessage:(NSString*)msg;

    Build 8.2.0 [16/July/2019]

    - TRC Removal

    - Caching Removal

    - Mraid Viewable Definition Change

    - Bug fixes

    Build 8.1.2 [16/July/2019]

    - Audience bidding support for DFP

    - SDK size Reduction

    - New api to set slot size for Banner in Audience Bidding

    - Bug fixes

    Build 8.1.1 [13/June/2019]

    - Adapter updates for the following mediation partners:

    • AdColony - 3.3.8
    • Facebook - 5.3.2

    - Bug fixes

    Build 8.1.0 [09/May/2019]

    - Audience bidding support for AppNexus

    - Added bid response support for Audience bidding

    - Added DFP Custom Event support

    - Bug fixes

    Build 8.0.8 [17/April/2019]

    - Addressing issue with layering of FAN banners upon refresh

    Build 8.0.7 [09/April/2019]

    - Audience bidding support for APS

    - Additional support for higher granularity keywords

    Build 8.0.5 [11/Mar/2019]

    - Audience bidding support for MoPub

    - Adapter updates for the following mediation partners:

    • AdColony - 3.3.6
    • AppLovin - 6.1.4
    • Chartboost - 7.3.0
    • Facebook - 5.1.0
    • Flurry - 9.2.3
    • MoPub - 5.4.1
    • MyTarget - 4.8.8
    • Vungle - 6.3.2
    • OneMobile AOL (Millennial Media) - 6.8.2
    • Vungle - 6.3.2
    • Unity - 3.0.0

    - Deprecated Tremor support

    - Deprecated Flurry banner support

    - Added support for additional reporting for AppLovin and Chartboost

    - Bug fixes

    - Google open auction support

    Build 8.0.2 [12/Dec/2018]

    - Mediation bug fixes

    Build 8.0.1 [21/Nov/2018]

    - Added mediation support

    - Bug fixes

    Build 8.0.0 [17/Oct/2018]

    - Added OMSDK support

    - Unification of InMobi and AerServ SDK

    Build 7.3.1 [11/July/2019]

    - Google open auction support

    Build 7.3.0 [27/Jun/2019]

    - Bug Fixes and Optimization

    Build 7.2.9 [28/May/2019]

    - Bug Fixes

    Build 7.2.8 [30/Apr/2019]

    • - Framework size reduction
    • - Bug Fixes
    • - APIs Added
    • * IMNative Class
    • + -(void)nativeAdIsAvailable:(IMNative*)native;

    Build 7.2.7 [26/Feb/2019]

    • - Support for MMA Viewability in China
    • - Bug Fixes

    Build 7.2.4 [21/Jan/2019]

    - Bug Fixes

    Build 7.3.1 [11/July/2019]

    - Google open auction support

    Build 7.3.0 [27/Jun/2019]

    - Bug Fixes and Optimization

    Build 7.2.9 [28/May/2019]

    - Bug Fixes

    Build 7.2.8 [30/Apr/2019]

    • - Framework size reduction
    • - Bug Fixes
    • - APIs Added
    • * IMNative Class
    • + -(void)nativeAdIsAvailable:(IMNative*)native;

    Build 7.2.7 [26/Feb/2019]

    • - Support for MMA Viewability in China
    • - Bug Fixes

    Build 7.2.4 [21/Jan/2019]

    - Bug Fixes

    exchange | Swift Reward test

    Rewarded Video ads are short (15 sec), non-skippable HD videos, which a user opts-in to watch in exchange for rewards like virtual goods or in-game gifts. Preferred by acquisition and brand marketers, these are perfect for integrating in shop fronts, start of gameplay or end of gameplay and help increase the retention of the non paying users. With the reward action dependent only on completed video views, rewarded video ads provide high quality engaged users to advertisers and high eCPMs to publishers.

    Follow these simple steps and start monetizing with Rewarded Video ads:

    Setting up a Rewarded Video Ad

    After adding your app, select REWARDED VIDEO to create a placement for ad type Rewarded video.

    Once you select the placement type as rewarded video, you will be presented with the following.

    You can fill in the key value pair for reward details. SDK will provide this dictionary as a JSON string through a delegate method called interstitial(_ interstitial: IMInterstitial!, rewardActionCompletedWithRewards rewards: [AnyHashable : Any]!) when the video play has ended. You can also choose to handle these rewards completely at your end.

    Creating a Rewarded Video Ad

    Rewarded Video ads use IMInterstitial Class. The IMInterstitial is simply a UIViewController subclass displaying full screen ads that respond to user touch.

    Follow these steps to create the rewarded video ad unit programmatically:

    1. Import the headers and declare an interstitial instance in your ViewController.swift file. Your ViewController header file should look like this:
      import UIKit
      import InMobiSDK
      class ViewController: UIViewController, IMInterstitialDelegate {
          var interstitial: IMInterstitial?
      }
      		
    2. Instantiate the interstitial object. Your viewDidLoad method in ViewController.swift file should look like this:
      override func viewDidLoad() {
              super.viewDidLoad()
              interstitial = IMInterstitial.init(placementId: 1446377525790)
              interstitial?.delegate = self
              interstitial?.load()
      }
      		

      Important: Create only one object per placement ID and reuse it for subsequent ad loads.

    3. For ad status callbacks, implement the delegate property of IMInterstitial. The following callbacks are supported:
      /**
           * Notifies the delegate that the ad server has returned an ad. Assets are not yet available.
           * Please use interstitialDidFinishLoading: to receive a callback when assets are also available.
           */
          public func interstitialDidReceiveAd(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has finished loading and can be shown instantly.
           */
          public func interstitialDidFinishLoading(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has failed to load with some error.
           */
          public func interstitial(_ interstitial: IMInterstitial!, didFailToLoadWithError error: IMRequestStatus!) {
              NSLog("[ViewController %@]", #function)
              NSLog("Interstitial ad failed to load with error %@", error)
          }
          /**
           * Notifies the delegate that the interstitial would be presented.
           */
          public func interstitialWillPresent(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has been presented.
           */
          public func interstitialDidPresent(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has failed to present with some error.
           */
          public func interstitial(_ interstitial: IMInterstitial!, didFailToPresentWithError error: IMRequestStatus!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial will be dismissed.
           */
          public func interstitialWillDismiss(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has been dismissed.
           */
          public func interstitialDidDismiss(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has been interacted with.
           */
          public func interstitial(_ interstitial: IMInterstitial!, didInteractWithParams params: [AnyHashable : Any]!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the user has performed the action to be incentivised with.
           */
          public func interstitial(_ interstitial: IMInterstitial!, rewardActionCompletedWithRewards rewards: [AnyHashable : Any]!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the user will leave application context.
           */
          public func userWillLeaveApplication(from interstitial: IMInterstitial!){
              NSLog("[ViewController %@]", #function)
          }
      		
    4. To show the Interstitial ad, use the following code:
      interstitial?.show(from: self)
      //interstitial?.show(from: self, with:.coverVertical)
      		

      Here are the possible animation types:

      • coverVertical
      • flipHorizontal
      • none

    Important:

    • Make sure that interstitialDidFinishLoading delegate is fired before making a call to show(from viewController: UIViewController!). Otherwise, the error callback interstitial(_ interstitial: IMInterstitial!, didFailToLoadWithError error: IMRequestStatus!) will be fired. Keep listening to the interstitial states to call show only when the ad is fully loaded.
    • Every time an interstitial ad is shown and subsequently dismissed, you will need to invoke interstitial?.load() again. Without this, you won't be able to call show(from viewController: UIViewController!) again.
    • Implement the interstitial(_ interstitial: IMInterstitial!, rewardActionCompletedWithRewards rewards: [AnyHashable : Any]!) method of IMInterstitialDelegate to detect video completion. If you have specified rewards on the InMobi portal, you can access the JSON dictionary here.

    Retrieving CreativeID

    At times, there are rogue advertisers who escape all the 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.

    mInterstitialAd.creativeId //mInterstitialAd is an example instance.

    Testing the Integration

    1. Configure the test mode on InMobi portal.

      Go to Tools - Diagnostics and switch Test Mode to either Global ON or Selective ON.

      If you are integrating an ad unit for the first time Set Test Mode to Global ON.
      If you want to selectively turn on test traffic for a set of devices·

      You already have a prior version of the SDK integrated for this particular ad unit and therefore you should restrict your testing to only few devices
      Set Test Mode to Selective ON.

      In the device section:

      1. In the Device ID box, type the device ID.
      2. In the Device Name box, set any name.
      3. Click Add Device to add the test device.

      If you already have a device configured, you can select the device and test mode will be enabled.

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

      Now you are all set to get test ads.

      Getting the Device ID

      The device id is basically the IDFA or IFA (Identifier for Advertising). To get device ID, the easiest approach is to set the log level of the SDK to “debug”. To enable debug logs, add this to didFinishLaunchingWithOptions method within the AppDelegate.swift file, as shown below:

      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
              //Initialize InMobi SDK with your account ID
              IMSdk.initWithAccountID("Insert InMobi account ID here")
              IMSdk.setLogLevel(.debug)
              // Do your stuff.
              return true
          }
      		

      In the debug mode, the device ID will be logged on XCode developer console as: “Publisher device ID is <device-id>”

      You can enter this device id in the Device ID box.

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

    3. You should also see these key InMobi SDK logs in console when a rewarded video ad is successfully loaded:

      [InMobi] InMobi SDK initialized with account id: <your account id here>

      [InMobi] Fetching interstitial ad for placement id: <your placement id here>

      [InMobi] Publisher device id is <device id here>

      [InMobi] Interstitial ad successfully fetched for placement id: <your placement id here>

    4. Now you would also see the InMobi test ads on your application.
    5. If the SDK is not initialised correctly before creating an ad, you would typically see these logs :

      ** ERROR ** [InMobi] ___ Please initialize the SDK before creating a <ad format> ad.

      ** ERROR ** [InMobi] ___ Account id cannot be null or empty. Please provide a valid Account id.

      [InMobi] Invalid account id passed to init. Please provide a valid account id.

    The complete set of key logs are documented in the following tables.

    SDK Initialization

    Scenario Log Level Logs
    Publisher passed null or empty account id Error Account id cannot be null or empty. Please provide a valid Account id.
    Publisher passed a valid account id Debug InMobi SDK initialized with account id: <account id>
    Publisher passed an invalid account Id Error Invalid account id passed to init. Please provide a valid account id.
    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

    Ads Common

    Scenario Log Level Logs
    Ad requested when no network available Error Network not reachable currently. Please try again.
    Ad requested when ad state is loading or available Error An ad load is already in progress. Please wait for the load to complete before requesting for another ad (Placement id :<placement id> ).
    Ad requested when ad is viewed by user Error 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> ).
    Publisher device Id Debug Publisher device id is <Device Id>

    Rewarded Video Ads

    Scenario Log Level Logs
    Publisher created a interstitial without initializing the SDK Error Please initialize the SDK before creating a interstitial ad
    Publisher created a interstitial with an invalid placement id Error Please provide a valid placement id to create a interstitial ad
    Publisher called load on an interstitial Debug Fetching an interstitial ad for placement id: <placement id>
    Successfully fetched ad Debug Interstitial ad successfully fetched for placement id: <placement id>
    Failed to fetch the ad Error Failed to fetch Interstitial ad for placement id:<Placement id> with error:<Status code / message>
    Started loading the interstitial in a webview Debug Started loading Interstitial ad markup in the webview for placement id: <Placement id>
    Interstitial successfully loaded in the webview Debug Successfully loaded Interstitial ad markup in the webview for placement id: <placement id>
    Failed to load interstitial in the webview Error Failed to load the Interstitial markup in the webview for placement id: <placement id>
    Interstitial Ad displayed Debug Successfully displayed Interstitial for placement id:<placement id>
    Interstitial Ad dismissed Debug Interstitial ad dismissed for placement id:<placement id>
    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
    Full screen ad cannot be displayed without a view controller. Please pass a view controller to present the full screen ad. Error Full screen ad cannot be displayed without a view controller. Please pass a view controller to present the full screen ad.

    exchange | Swift Full test

    Full-screen video ads are short (15-30 sec), skippable videos, which help in monetization with high eCPMs. Preferred by brands and game developers, these are perfect for happy moments such as level wins and wait times in Player vs Player (PVP). Video ads leverage the power of sight, sound, and motion to create immersive experiences for the user thereby enhancing the in-app ad experience.

    To create a video ad, you need to use an interstitial ad placement. On creating an interstitial ad placement you will find controls on the InMobi portal to either run a mix of static and video ads OR 100% video ads only.

    You also have access to advanced video controls on whether you want to run skippable video ads and only when the user is on Wifi.

    Follow these simple steps and start monetizing with Video ads:

    Setting up a Full-screen Video Ad

    After adding your app, select INTERSTITIAL to create a placement for ad type Interstitial.

    Once you create the Interstitial placement, you will have the placement id.

    Creating a Full-screen Video Ad

    The IMInterstitial is simply a UIViewController subclass displaying full screen ads that respond to user touch.

    Follow these steps to create the interstitial ad unit programmatically:

    1. Import the headers and declare an interstitial instance in your ViewController.swift file. Your ViewController header file should look like this:
      import UIKit
      import InMobiSDK
      class ViewController: UIViewController, IMInterstitialDelegate {
          var interstitial: IMInterstitial?
      }
      		
    2. Instantiate the interstitial object. Your viewDidLoad method in ViewController.swift file should look like this:
      override func viewDidLoad() {
              super.viewDidLoad()
              interstitial = IMInterstitial.init(placementId: 1446377525790)
              interstitial?.delegate = self
              interstitial?.load()
      }
      		

      Important: Create only one object per placement ID and reuse it for subsequent ad loads.

    3. For ad status callbacks, implement the delegate property of IMInterstitial. The following callbacks are supported:
      /**
           * Notifies the delegate that the ad server has returned an ad. Assets are not yet available.
           * Please use interstitialDidFinishLoading: to receive a callback when assets are also available.
           */
          public func interstitialDidReceiveAd(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has finished loading and can be shown instantly.
           */
          public func interstitialDidFinishLoading(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has failed to load with some error.
           */
          public func interstitial(_ interstitial: IMInterstitial!, didFailToLoadWithError error: IMRequestStatus!) {
              NSLog("[ViewController %@]", #function)
              NSLog("Interstitial ad failed to load with error %@", error)
          }
          /**
           * Notifies the delegate that the interstitial would be presented.
           */
          public func interstitialWillPresent(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has been presented.
           */
          public func interstitialDidPresent(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has failed to present with some error.
           */
          public func interstitial(_ interstitial: IMInterstitial!, didFailToPresentWithError error: IMRequestStatus!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial will be dismissed.
           */
          public func interstitialWillDismiss(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has been dismissed.
           */
          public func interstitialDidDismiss(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has been interacted with.
           */
          public func interstitial(_ interstitial: IMInterstitial!, didInteractWithParams params: [AnyHashable : Any]!) {
              NSLog("[ViewController %@]", #function)
          }
             /**
           * Notifies the delegate that the user will leave application context.
           */
          public func userWillLeaveApplication(from interstitial: IMInterstitial!){
              NSLog("[ViewController %@]", #function)
          }
      		
    4. To show the Interstitial ad, use the following code:
      interstitial?.show(from: self)
      //interstitial?.show(from: self, with:.coverVertical)
      		

      Here are the possible animation types:

      • coverVertical
      • flipHorizontal
      • none

    Important: Make sure that interstitialDidFinishLoading delegate is fired before making a call to show(from viewController: UIViewController!). Otherwise, the error callback interstitial(_ interstitial: IMInterstitial!, didFailToLoadWithError error: IMRequestStatus!) will be fired. Every time an interstitial ad is shown and subsequently dismissed, you will need to invoke interstitial?.load() again. Without this, you won't be able to call show(from viewController: UIViewController!) again.

    Retrieving CreativeID

    At times, there are rogue advertisers who escape all the 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.

    mInterstitialAd.creativeId //mInterstitialAd is an example instance.

    Testing the Integration

    1. Configure the Test Mode on InMobi portal.

      Go to Tools - Diagnostics and switch Test Mode to either Global ON or Selective ON.

      If you are integrating an ad unit for the first time Set Test Mode to Global ON.
      If you want to selectively turn on test traffic for a set of devices·

      You already have a prior version of the SDK integrated for this particular ad unit and therefore you should restrict your testing to only few devices
      Set Test Mode to Selective ON.

      In the device section:

      1. In the Device ID box, type the device ID.
      2. In the Device Name box, set any name.
      3. Click Add Device to add the test device.

      If you already have a device configured, you can select the device and test mode will be enabled.

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

      Now you are all set to get test ads.

      Getting the Device ID

      The device id is basically the IDFA or IFA (Identifier for Advertising). To get device ID, the easiest approach is to set the log level of the SDK to “debug”. To enable debug logs, add this to didFinishLaunchingWithOptions method within the AppDelegate.swift file, as shown below:

      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
              //Initialize InMobi SDK with your account ID
              IMSdk.initWithAccountID("Insert InMobi account ID here")
              IMSdk.setLogLevel(.debug)
              // Do your stuff.
              return true
          }
      		

      In the debug mode, the device ID will be logged on XCode developer console as: “Publisher device ID is <device-id>”

      You can enter this device id in the Device ID box.

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

      [InMobi] Fetching interstitial ad for placement id: <your placement id here>

      [InMobi] Publisher device id is <device id here>

      [InMobi] Interstitial ad successfully fetched for placement id: <your placement id here>

    3. Now you would also see the InMobi test ads on your application.
    4. If the SDK is not initialised correctly before creating an ad, you would typically see these logs :

      ** ERROR ** [InMobi] ___ Please initialize the SDK before creating a <ad format> ad.

      ** ERROR ** [InMobi] ___ Account id cannot be null or empty. Please provide a valid Account id.

      [InMobi] Invalid account id passed to init. Please provide a valid account id.

    The complete set of key logs are documented in the following tables.

    SDK Initialization

    Scenario Log Level Logs
    Publisher passed null or empty account id Error Account id cannot be null or empty. Please provide a valid Account id.
    Publisher passed a valid account id Debug InMobi SDK initialized with account id: <account id>
    Publisher passed an invalid account Id Error Invalid account id passed to init. Please provide a valid account id.
    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

    Ads Common

    Scenario Log Level Logs
    Ad requested when no network available Error Network not reachable currently. Please try again.
    Ad requested when ad state is loading or available Error An ad load is already in progress. Please wait for the load to complete before requesting for another ad (Placement id :<placement id> ).
    Ad requested when ad is viewed by user Error 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> ).
    Publisher device Id Debug Publisher device id is <Device Id>

    Video Ads

    Scenario Log Level Logs
    Publisher created a interstitial without initializing the SDK Error Please initialize the SDK before creating a interstitial ad
    Publisher created a interstitial with an invalid placement id Error Please provide a valid placement id to create a interstitial ad
    Publisher called load on an interstitial Debug Fetching an interstitial ad for placement id: <placement id>
    Successfully fetched ad Debug Interstitial ad successfully fetched for placement id: <placement id>
    Failed to fetch the ad Error Failed to fetch Interstitial ad for placement id:<Placement id> with error:<Status code / message>
    Started loading the interstitial in a webview Debug Started loading Interstitial ad markup in the webview for placement id: <Placement id>
    Interstitial successfully loaded in the webview Debug Successfully loaded Interstitial ad markup in the webview for placement id: <placement id>
    Failed to load interstitial in the webview Error Failed to load the Interstitial markup in the webview for placement id: <placement id>
    Interstitial Ad displayed Debug Successfully displayed Interstitial for placement id:<placement id>
    Interstitial Ad dismissed Debug Interstitial ad dismissed for placement id:<placement id>
    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
    Full screen ad cannot be displayed without a view controller. Please pass a view controller to present the full screen ad. Error Full screen ad cannot be displayed without a view controller. Please pass a view controller to present the full screen ad.

    exchange | Swift Inter test

    Interstitial ads are full page ads placed at natural break points in the app flow. With 10 times the real estate as compared to banner ads, Interstitials are guaranteed to catch your users' eyes and drive higher revenue for your mobile business.

    Follow these steps to start monetizing with Interstitial ads:

    Setting up an Interstitial Ad

    After adding your app, select INTERSTITIAL to create a placement for ad type Interstitial.

    Once you create the Interstitial placement, you will have the placement id.

    Creating an Interstitial Ad

    The IMInterstitial is simply a UIViewController subclass displaying full screen ads that respond to user touch.

    Follow these steps to create the interstitial ad unit programmatically:

    1. Import the headers and declare an interstitial instance in your ViewController.swift file. Your ViewController header file should look like this:
      import UIKit
      import InMobiSDK
      class ViewController: UIViewController, IMInterstitialDelegate {
          var interstitial: IMInterstitial?
      }
      		
    2. Instantiate the interstitial object. Your viewDidLoad method in ViewController.swift file should look like this:
      override func viewDidLoad() {
              super.viewDidLoad()
              interstitial = IMInterstitial.init(placementId: 1446377525790)
              interstitial?.delegate = self
              interstitial?.load()
      }
      		
    3. For ad status callbacks, implement the delegate property of IMInterstitial. The following callbacks are supported:
       /**
           * Notifies the delegate that the ad server has returned an ad. Assets are not yet available.
           * Please use interstitialDidFinishLoading: to receive a callback when assets are also available.
           */
          public func interstitialDidReceiveAd(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has finished loading and can be shown instantly.
           */
          public func interstitialDidFinishLoading(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has failed to load with some error.
           */
          public func interstitial(_ interstitial: IMInterstitial!, didFailToLoadWithError error: IMRequestStatus!) {
              NSLog("[ViewController %@]", #function)
              NSLog("Interstitial ad failed to load with error %@", error)
          }
          /**
           * Notifies the delegate that the interstitial would be presented.
           */
          public func interstitialWillPresent(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has been presented.
           */
          public func interstitialDidPresent(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has failed to present with some error.
           */
          public func interstitial(_ interstitial: IMInterstitial!, didFailToPresentWithError error: IMRequestStatus!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial will be dismissed.
           */
          public func interstitialWillDismiss(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has been dismissed.
           */
          public func interstitialDidDismiss(_ interstitial: IMInterstitial!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the interstitial has been interacted with.
           */
          public func interstitial(_ interstitial: IMInterstitial!, didInteractWithParams params: [AnyHashable : Any]!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the user will leave application context.
           */
          public func userWillLeaveApplication(from interstitial: IMInterstitial!){
              NSLog("[ViewController %@]", #function)
          }
      		
    4. To show the Interstitial Ad, use the following code:
      interstitial?.show(from: self)
      //interstitial?.show(from: self, with:.coverVertical)
      		

      Here are the possible animation types:

      • coverVertical
      • flipHorizontal
      • none

    Important:

    • Make sure that interstitialDidFinishLoading delegate is fired before making a call to show(from viewController: UIViewController!). Otherwise, the error callback interstitial(_ interstitial: IMInterstitial!, didFailToLoadWithError error: IMRequestStatus!) will be fired.
    • Every time an interstitial ad is shown and subsequently dismissed, you will need to invoke interstitial?.load() again. Without this, you won't be able to call show(from viewController: UIViewController!) again.

    Retrieving CreativeID

    At times, there are rogue advertisers who escape all the 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.

    		public func interstitialDidFinishLoading(_ interstitial: IMInterstitial!) {
            interstitial.creativeId
        }
    	

    Testing the Integration

    1. Configure the test mode on InMobi portal.

      Go to Tools - Diagnostics and switch Test Mode to either Global ON or Selective ON.

      If you are integrating an ad unit for the first time Set Test Mode to Global ON.
      If you want to selectively turn on test traffic for a set of devices·

      You already have a prior version of the SDK integrated for this particular ad unit and therefore you should restrict your testing to only few devices
      Set Test Mode to Selective ON.

      In the device section:

      1. In the Device ID box, type the device ID.
      2. In the Device Name box, set any name.
      3. Click Add Device to add the test device.

      If you already have a device configured, you can select the device and test mode will be enabled.

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

      Now you are all set to get test ads.

      Getting the Device ID

      import AdSupport
      let deviceId = ASIdentifierManager.shared().advertisingIdentifier.uuidString
      		

      You can enter this device id in the Device ID box.

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

    3. You should also see these key InMobi SDK logs in console when a interstitial ad is successfully loaded:

      [InMobi] InMobi SDK initialized with account id: <your account id here>

      [InMobi] Fetching interstitial ad for placement id: <your placement id here>

      [InMobi] Publisher device id is <device id here>

      [InMobi] Interstitial ad successfully fetched for placement id: <your placement id here>

    4. Now you would also see the InMobi test ads on your application.
    5. If the SDK is not initialised correctly before creating an ad, you would typically see these logs :

      ** ERROR ** [InMobi] ___ Please initialize the SDK before creating a <ad format> ad.

      ** ERROR ** [InMobi] ___ Account id cannot be null or empty. Please provide a valid Account id.

      [InMobi] Invalid account id passed to init. Please provide a valid account id.

    The complete set of key logs are documented in the following tables.

    SDK Initialization

    Scenario Log Level Logs
    Publisher passed null or empty account id Error Account id cannot be null or empty. Please provide a valid Account id.
    Publisher passed a valid account id Debug InMobi SDK initialized with account id: <account id>
    Publisher passed an invalid account Id Error Invalid account id passed to init. Please provide a valid account id.
    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

    Ads Common

    Scenario Log Level Logs
    Ad requested when no network available Error Network not reachable currently. Please try again.
    Ad requested when ad state is loading or available Error An ad load is already in progress. Please wait for the load to complete before requesting for another ad (Placement id :<placement id> ).
    Ad requested when ad is viewed by user Error 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> ).

    Interstitial Ads

    Scenario Log Level Logs
    Publisher created a interstitial without initializing the SDK Error Please initialize the SDK before creating a interstitial ad
    Publisher created a interstitial with an invalid placement id Error Please provide a valid placement id to create a interstitial ad
    Publisher called load on an interstitial Debug Fetching an interstitial ad for placement id: <placement id>
    Successfully fetched ad Debug Interstitial ad successfully fetched for placement id: <placement id>
    Failed to fetch the ad Error Failed to fetch Interstitial ad for placement id:<Placement id> with error:<Status code / message>
    Started loading the interstitial in a webview Debug Started loading Interstitial ad markup in the webview for placement id: <Placement id>
    Interstitial successfully loaded in the webview Debug Successfully loaded Interstitial ad markup in the webview for placement id: <placement id>
    Failed to load interstitial in the webview Error Failed to load the Interstitial markup in the webview for placement id: <placement id>
    Interstitial Ad displayed Debug Successfully displayed Interstitial for placement id:<placement id>
    Interstitial Ad dismissed Debug Interstitial ad dismissed for placement id:<placement id>
    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
    Full screen ad cannot be displayed without a view controller. Please pass a view controller to present the full screen ad. Error Full screen ad cannot be displayed without a view controller. Please pass a view controller to present the full screen ad.

    Advanced: InMobi Custom Frames

    Supercharge the full-screen experience by making the most of your in-game assets like characters, themes, and interactions to introduce interstitial ads which look like an extension of your game design.

    Getting Started with Custom Frames

    In order to activate Custom Frames on your interstitial ads, integrate with InMobi Interstitial ads and activate “Custom Frames” while creating the Interstitial placement.

    1. Specify the device you want to target the ad, and then select the orientation of your interstitial ad.
    2. Upload a frame, or select one of the preset frames. Ensure that you comply with the “Custom Frame Specification” mentioned in the section below.
    3. Upload a close button, or select one of the preset close buttons. You can choose the placement of the close button at either the top left or top right corner.
    4. Change the creative size to fit the interstitial ad and modify the placement of the creative using the “Creative Ad Position” to fit the interstitial ad perfectly. Ensure that the creative fits into the inner container of the frame and does not spill out.

    More Details

    Understanding Device Size and Orientation

    InMobi Custom Frames are tied to a particular device size and orientation. This is important because you upload, or select, a specific frame to go with the device size and orientation combination.

    Notes:

    • If you have an app that is usable in both landscape and portrait modes, and you make interstitial ad calls in both modes, you must create two custom frame ad units, one for each landscape and portrait. InMobi will automatically pick the right template based on the ad request orientation.
    • If you use the same placement Id for phones and tablets, you must create separate custom frame ad units for phones and tablets to make sure you can serve interstitial units with custom frames across all devices.
    Understanding InMobi Default Templates

    If you have at least one InMobi Custom Frame, you will see a listing page containing different custom frames, along with their performance metrics. The first item is called InMobi Default. You cannot edit this template, nor can you pause or delete this unit.

    InMobi Default templates are used in two cases:

    • When an incoming ad request and ad combination does not match any custom frame unit created.
    • When InMobi, through its optimization logic, detects that not using a custom frame might actually give better performance. For example, there are certain creatives that will not work with custom frames. In this case, the InMobi Default template is used to make sure that InMobi can render these high eCPM creatives in your ad slot.

    Note: You cannot turn off the InMobi Default template.

    Custom Frame Specification

    Please keep in mind the following when designing custom frames for your interstitial ads:

    • The ad will appear in a transparent area (called the 'inner container') inside the frame.

    • In the image above, the inner container is the section in blue.
      • The inner container must be a rectangular figure with the same aspect ratio as the interstitial ad slot. That is, 2:3 for a 320x480 slot, 8:5 for a 1280x800 slot, and so on.
      • The inner container must be a transparent area.
      • The inner container cannot be less than 70% of the interstitial size. This means that for a 320x480 interstitial slot, the inner container should not be less than 224x336.
      • The inner edges of the frame must not be cluttered. That is, it should not disrupt the inner ad area. Strict rectangular corners, or very slightly rounded corners are allowed.
      • Refer the table below for the sizes supported:
      Device Orientaton Frame Size Inner Container Size

      Smartphone 1

      Portrait

      320x480 (RGB, 72ppi)

      240x360

      Landscape

      480x320 (RGB, 72ppi)

      360x240

      Smartphone 2

      Portrait

      320x568 (RGB, 72ppi)

      250x444

      Landscape

      568x320 (RGB, 72ppi)

      444x250

      Tablet 1

      Portrait

      768x1024 (RGB, 72ppi)

      576x768

      Landscape

      1024x768 (RGB, 72ppi)

      768x576

      Tablet 2

      Portrait

      800x1280 (RGB, 72ppi)

      600x960

      Landscape

      1280x800 (RGB, 72ppi)

      960x600

    • Create the close button on a transparent area with an aspect ratio of 1:1. The allowed sizes are 15x15 px or 40x40 px.

    Notes:

    • Frames and Close buttons must be uploaded in PNG format.
    • Background color and translucency are added by the SDK.

    A/B Testing

    Experiment with custom frames for the same interstitial placement by creating multiple concepts (for example, different colors, different characters, with and without animation, and so on) and distributing exposure across these concepts.

    • When testing new concepts, limit exposure to them to ensure that the monetization potential of your property is not affected. To limit the number of ad impressions served on the new concepts, you can select the Limit Exposure check box.
    • Once you are sure of the performance of the concept, you can uncheck the Limit Exposure check box.

    exchange | Swift Banner test

    Banner Ads are graphical ad, typically including a combination of static/animated images and text designed to convey a marketing message and/or cause the user to take an action. All types of apps can leverage banner ads for monetization.

    Follow these steps to start monetizing with Banner ads:

    Setting up a Banner Ad

    After adding your app, select BANNER AD to create a placement for ad type Banner.

    Once you create the banner placement, you will have the placement id.

    Creating a Banner Ad

    The IMBanner is simply a UIView subclass displaying HTML ads. The InMobi SDK provides two mechanisms to implement a banner ad:

    a. Programmatic Instantiation

    1. Import the frameworks and declare a Banner instance in your ViewController.swift file. Your ViewController header file should look like this:
      import UIKit
      import InMobiSDK
      class ViewController: UIViewController, IMBannerDelegate {
          var banner: IMBanner?
      }
      		
    2. Instantiate the banner object. Your ViewController.m file should look like this:
      override func viewDidLoad() {
              super.viewDidLoad()
              banner = IMBanner.init(frame: CGRect(x: 0, y: 0, width: 320, height: 50), placementId: <Insert your placement ID here>)
              banner?.delegate = self
              self.view.addSubview(banner!)
              banner?.load()
              // Use this API to enable or disable auto refresh
              banner?.shouldAutoRefresh(true)
              // Use this API to set a custom refresh interval on the banner
              banner?.refreshInterval = 90
          }
      		

      By default, IMBanner refreshes after every 60 seconds. You can also set a custom refresh interval or turn off AutoRefresh to manually load ads. For both manual load and Auto Refresh, the minimum time interval between two successive ad loads should be 20 seconds.

      // to turn off auto refresh set the below value to NO.
      [self.banner shouldAutoRefresh:NO];
      //to set custom refresh interval
      [self.banner setRefreshInterval:40];
      		
    3. If at any time you want to release the banner:
       // perform the deinitialization
        banner?.delegate = nil
      banner = nil
      		
    4. For ad status callbacks, implement the delegate methods of IMBannerDelegate. The following callbacks are supported:
      /**
           * Notifies the delegate that the banner has finished loading
           */
          public func bannerDidFinishLoading(_ banner: IMBanner!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the banner has failed to load with some error.
           */
          public func banner(_ banner: IMBanner!, didFailToLoadWithError error: IMRequestStatus!) {
              NSLog("[ViewController %@]", #function)
              NSLog("Banner ad failed to load with error %@", error)
          }
          /**
           * Notifies the delegate that the banner was interacted with.
           */
          public func banner(_ banner: IMBanner!, didInteractWithParams params: [AnyHashable : Any]!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the user would be taken out of the application context.
           */
          public func userWillLeaveApplication(from banner: IMBanner!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the banner would be presenting a full screen content.
           */
          public func bannerWillPresentScreen(_ banner: IMBanner!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the banner has finished presenting screen.
           */
          public func bannerDidPresentScreen(_ banner: IMBanner!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the banner will start dismissing the presented screen.
           */
          public func bannerWillDismissScreen(_ banner: IMBanner!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the banner has dismissed the presented screen.
           */
          public func bannerDidDismissScreen(_ banner: IMBanner!) {
              NSLog("[ViewController %@]", #function)
          }
          /**
           * Notifies the delegate that the user has completed the action to be incentivised with.
           */
          public func banner(_ banner: IMBanner!, rewardActionCompletedWithRewards rewards: [AnyHashable : Any]!){
              NSLog("[ViewController %@]", #function)
          }
      		
    5. You can use the following transitions while refreshing your banner object:
      • none
      • flipFromLeft
      • flipFromRight
      • curlUp
      • curlDown
      banner?.transitionAnimation = .curlUp
      		

    b. Creating a Banner Instance through Interface Builder

    1. Place the UIView in your ViewController’s view at the position where the ad should be displayed.
    2. Set the banner frame.
    3. Set the Class Identity of the UIView to IMBanner.
    4. In your ViewController header file, declare an IBOutlet instance of IMBanner.
    5. Set this as your outlet in your UIView(Banner) in the ViewController Scene in the Storyboard.

    Retrieving CreativeID

    At times, there are rogue advertisers who escape all the 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.

    public func bannerDidFinishLoading(_ banner: IMBanner!) {
           bannerAd.creativeId // mBannerAd is an example instance 
        }
    	

    Testing the Integration

    1. Configure the test mode on InMobi portal.

      Go to Tools - Diagnostics and switch Test Mode to either Global ON or Selective ON.

      If you are integrating an ad unit for the first time Set Test Mode to Global ON.
      If you want to selectively turn on test traffic for a set of devices·

      You already have a prior version of the SDK integrated for this particular ad unit and therefore you should restrict your testing to only few devices
      Set Test Mode to Selective ON.

      In the device section:

      1. In the Device ID box, type the device ID.
      2. In the Device Name box, set any name.
      3. Click Add Device to add the test device.

      If you already have a device configured, you can select the device and test mode will be enabled.

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

      Now you are all set to get test ads.

      Getting the Device ID

      The device id is basically the IDFA or IFA (Identifier for Advertising). To get device ID:

      import AdSupport
      let deviceId = ASIdentifierManager.shared().advertisingIdentifier.uuidString
      		

      You can enter this device id in the Device ID box.

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

    3. You should also see these key InMobi SDK logs in console when a banner ad is successfully loaded:

      [InMobi] InMobi SDK initialized with account id:

      [InMobi] Loading Banner ad for placement id:

      [InMobi] Banner ad successfully fetched for placement id:

    4. Now you would also see the InMobi test ads on your application.
    5. If the SDK is not initialised correctly before creating an ad, you would typically see these logs :

      ** ERROR ** [InMobi] ___ Please initialize the SDK before creating a <ad format> ad.

      ** ERROR ** [InMobi]

      [InMobi] Invalid account id passed to init. Please provide a valid account id.

    The important set of logs are documented in the following tables.

    SDK Initialization

    Scenario Log Level Logs
    Publisher passed valid account id Debug InMobi SDK initialized with account id:
    Publisher passed an invalid account Id Error Invalid account id passed to init. Please provide a valid account id.
    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.

    Ads Common

    Scenario Log Level Logs
    Ad requested when no network available Error Network not reachable currently. Please try again.
    Ad requested when ad state is loading or available Error An ad load is already in progress. Please wait for the load to complete before requesting for another ad (Placement id : ).
    Ad requested when ad is viewed by user Error 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 : ).

    Banner Ads

    Scenario Log Level Logs
    Publisher created a banner without initializing the SDK Error Please initialize the SDK before creating a Banner ad
    Publisher created a banner with an invalid/null placement id Error Please provide a valid placement id to create a Banner ad
    Publisher called load on a banner from IB/xml with improper placement id Error Please provide a valid placement id to create a Banner ad
    Publisher called load on a banner Debug Fetching a Banner ad for placement id: ( )
    Successfully fetched ad Debug Banner ad successfully fetched for placement id: ( )
    Failed to fetch the ad Debug Failed to fetch Banner ad for placement id: ( with error: )
    Started loading the banner in a webview Debug Started loading Banner ad markup in the webview for placement id: ( )
    Banner successfully loaded in the webview Debug Successfully loaded Banner ad markup in the webview for placement id: ( )
    Failed to load banner in the webview Debug Failed to load the Banner markup in the webview for placement id: ( )
    Banner refresh is initiated Debug Initiating Banner refresh for placement id: ( )

    exchange | Swift test

    Getting Started with iOS Integration

    You can get started with the following:

    The latest version of InMobi SDK supports iOS 10.0 and later. Also, this version of iOS SDK requires XCode 10.9 and later.

    Note: We recommend to call all InMobi APIs on main thread.

    Version 9.0.0 7.4.0
    Size (.IPA Inflation) 691 KB TBA
    SDK Links

    Step 1: Adding the SDK to your Project

    Option 1: Integration via Cocoapods

    1. If you are not already using Cocoapods, go to your Xcode project directory and create a pod file using the command below.
      pod init
      				
    2. Add the following to Podfile.
      pod 'InMobiSDK'
      				
    3. Once you have added it to the pod file, run the command below to complete the task for dependency. You now have a workspace with the pods.
      pod install
      				

    Option 2: Integrating the framework directly

    Alternatively, you can integrate the framework directly.

    1. Add the following MANDATORY frameworks to your Xcode project:

    • InMobiSDK.framework from the downloaded InMobi iOS SDK bundle
    • libsqlite3.0.tbd
    • libz.tbd
    • WebKit.framework

    2. Add -ObjC flag to the Other Linker Flags:

    1. Open your project in Xcode.
    2. Select Application Target > Build Settings.
    3. In the Search box, search for Other Linker Flags.
    4. Add the -ObjC flag

    Important Prerequisites:

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

    Checkpoint 1: Preparing your App for iOS 10

    App Transport Security (ATS), a default setting introduced with iOS 9 that mandates apps to make network connections only over TLS version 1.2 and later. Though InMobi is committed towards the adoption of HTTPS, the current setup requires our demand partners to support this change and be 100% compliant with all the requirements of ATS.

    While we work with our partners progressing towards a secure environment, to ensure ads work on iOS 9 and later versions, you need to follow these steps as a near-term fix:

    • Disable ATS (Recommended) - to ensure non-secure content from the partners work correctly in your updated apps. To disable ATS flag, add the following code snippet to your app's Info.plist.

      <key>NSAppTransportSecurity</key>
      <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/>
      </dict>
      				
    • Disable ATS with exceptions (Not Recommended) - if you plan to migrate towards ATS compliance. You can achieve so by allowing secure content from your domains by adding them on the exception list.
      <key>NSAppTransportSecurity</key>
      <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/>
      <key>NSExceptionDomains</key>
      <dict>
      <key>example.com</key>
      <dict>
      <key>NSIncludesSubdomains</key>
      <true/>
      </dict>
      </dict>
      </dict>
      				

    Remember: Refrain from using InMobi domains and CDN in the exception list as it will result in errors during the runtime.

    Checkpoint 2: iOS 12 WiFi Settings

    Apple has introduced privacy settings to access WiFi details from iOS 12 onwards. To boost monetization and relevant user experience, we encourage sharing WiFi details for targeted advertising.

    1. Enable ‘Access WiFi Information’ on your App ID.

    2. Enable access ‘Access WiFi Information’ for your target app from XCode capabilities.

    3. Ensure WiFi Access is added to your App.entitlements file.

    Note:Please ask the user for location consent. Here is how how to do that.

    Step 2: Initializing the SDK

    Step 2.1 Import the InMobi SDK header in your AppDelegate.h file:

    @import InMobiSDK;
    /**Please do not remove the window property as it can lead to undefined behavior**/
    // var window: UIWindow;
    			

    Step 2.2 Initialize the SDK in the didFinishLaunchingWithOptions method within the app delegate's .m file:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
            /*
             * Enable logging for better debuggability. Please turn off the logs before submitting your App to the AppStore
             */
            IMSdk.setLogLevel(IMSDKLogLevel.debug)
            /*
             * Initialize the InMobi SDK immediately after the app launches.
             *
             * For EU Region use the following init api to pass user consent for data collection, for GDPR Compliance.
             */
            let conscentDict: NSDictionary = [IM_GDPR_CONSENT_AVAILABLE : "true"]
            IMSdk.initWithAccountID(INMOBI_ACCOUNT_ID, consentDictionary:conscentDict as? [AnyHashable : Any])
            return true
        }
    			

    Let’s understand a few things here before you proceed:

    What is a consentObject? - A consentObject is a dictionary representation of all kinds of consent provided by the publisher to the SDK. The key is mandatory if you wish to monetize traffic from EEA region. You can read further on GDPR regulations here.

    Key Type Inference
    gdpr_consent_available String "true" : User has provided consent to collect and use data.

    "false": User has not provided consent to collect and use data.

    Any value other than “true” and “false” is invalid and will be treated as value not provided by user.

    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 (0 = No, 1 = Yes), omission indicates Unknown.

    Important note on consentObject:

    1. consentObject has to be provided in every session. SDK does not persist consent, it only keeps the consentObject in memory. If the app is relaunched, SDK will lose the consentObject.
    2. Within a session, consentObject can be updated as below:
      [IMSdk updateGDPRConsent:@{<Insert consentObject dictionary here>}];
      				
    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.

    Note: You can locate your account ID from the account interface as shown in the image below:

    Step 2.3 | Pass the location information 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 set NSLocationWhenInUseUsageDescription flag (description for asking location permission) in your info.plist file.

    self.locationManager = CLLocationManager()
    self.locationManager.requestWhenInUseAuthorization()
    self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
    self.locationManager.delegate = self
    self.locationManager.startUpdatingLocation()
    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
            if let currentLocation = locations.last {
                IMSdk.setLocation(currentLocation);
                self.locationManager.stopUpdatingLocation();
            }
        }
    			

    Step 2.4 Pass age and gender information to allow better ad targeting. Ensure that you have user consent to share this data. The following values are supported:

    Age Gender
    • below18
    • between18And24
    • between25And29
    • between30And34
    • between35And44
    • between45And54
    • between55And65
    • Above65
    • male
    • female

    Example:

    IMSdk.setGender(.male)
    IMSdk.setAgeGroup(.between25And29)
    			

    Note:

    Note: Audio Handling in WKWebView

    For publishers running any audio or video media as the main content, we recommend listening to interruptions by observing AVAudioSessionInterruptionnotification posted by AVAudioSession. This will help preempt any content interruptions and help address user experience issues upfront. For more information read these Apple documents: Article 1, Article 2.

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

    exchange | Swift Native test

    InMobi Native ads seamlessly blend in with your app’s content, maximizing user engagement without compromising on user experience. You can choose and customize the layout that best matches the design of your app. It is ideal for news, utility and communication apps.

    InMobi Native Ads can have video and/or static image both. Depending on the placement you can opt for:

    • In-Feed Ad - a muted autoplay HD video or a simple static image ad.
    • Splash Ad - blends in the launch screen of apps and monetize user time when the app is loading in the background. These ads can also be a muted autoplay HD video ad or a simple static image ad.

    Static Feed Ad

    InFeed Video Ad

    Splash Video Ad

    Follow these simple steps and start monetizing with Native ads:

    Setting up a Native Ad Placement

    1. Create a Native Content placement.

    2. In-Feed Video Ad Placement

      1. Select FEED as the Native Ad Layout.
      2. For In-Feed Video, select either of the aspect ratio 256:135 or 16:9. Both the aspect ratios will have default static native fallback enabled with similar aspect ratio.


      Static Feed Ad Placement

        Select FEED as the Native Ad Layout.

      Splash Video Ad Placement

      • Select SPLASH as the Native Ad Layout.

      • Select the desired aspect ratio. Default value for the aspect ratio will be 9:16.

      Others (China only)

      • Select Others as the Native Ad Layout.

      • Select aspect ratio 16:9. This will have default static native fallback enabled with similar aspect ratio.
      • A new sub field is added in Others layout called Native Layout Type. It has the following values: “Native Interstitial”, “Native Page”, “Native Banner”, “Native Focus”, “Native Lock Screen”, “Native Other”.
      • Default value will be Native Interstitial in Native layout type field.

      Pre-Roll Ad Integration

      • Select Pre-roll as the Native Ad Layout.

      • Save the Pre-roll native placement layout.

    Native Ad APIs

    The IMNative Class contains the following objects:

    • NSString* adTitle - Returns the title for the ad.
    • NSString* adDescription - Returns the description for the ad.
    • UIImage* adIcon - Returns icon image for the ad.
    • NSString* adCtaText - Returns click to action text for the ad.
    • NSString* adRating - Returns rating for the ad (optional).
    • NSURL* adLandingPageUrl - Returns landing URL for the ad.
    • BOOL isAppDownload - Returns whether the ad is for downloading an app.
    • NSString* customAdContent - This will have additional information (description, image URL, etc.), which can be used to create custom UI around the primary view of ad.

    The IMNative Class supports the following functions:

    • -(UIView*)primaryViewOfWidth:(CGFloat)width - Returns a UIView of specified width. 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 a