Guide on Integration InMobi SDK For Monetization Your Android App

Searching for the best ads monetizing solutions represents a pressing need of nowadays. It’s the right moment to explore the aspect in detail. We shall share our expertise to reveal the main advantages and disadvantages of ad services, moreover, you’ll learn on various critical details on SDK integrations.

Reasons to apply InMobi

Being among the most in-demand services monetizing apps, InMobi provides impressive perks. For instance, test accounts are designed to allow users to test diverse ad contents offered by the platform. Moreover, easy-to-use export/import filter configurations among placements are truly striking.

We shall devote our time for highlighting obvious facts clarifying such as InMobi’s ads popularity.

InMobi advantages:

  • multiple filters for targeting (available for admins, as well as for clients);
  • a great selection of ads kinds with the possibilities to configure them on a server (cost-free);
  • a convenient SDK allowing ads preload together with geolocation details collection (in an automatic way);
  • a reliable SDK for updating banner ads, showing native ads of various customized sizes;
  • possibilities to file a complaint against specific ads and advertisers;
  • in-depth documentation;
  • possible integration with AdMob, ironSource, Appodeal, others.

Let’s review the other side of this coin as well.

InMobi disadvantages:

  • opportunities for applying only pre-determined sizes of banner ads;
  • Dependencies require inclusion of the specific library – the Picasso one.

Obviously, InMobi provides many more benefits than drawbacks, while the fundamental advantage we’re interested in this time is m-service monetizing possibilities.

Integration of InMobi SDK

Our mission is to lead you to step by step through the integration phases so you receive a response to your question of how to monetize the app by means of such a solution.

Stage 1.

The primary task is to get registered on InMobi to receive the key which you’ll require during Stage 4.

Stage 2.

Now you shall get connected to the project by including such files into the build.gradle file:

repositories {
dependencies {
    compile 'com.inmobi.monetization:inmobi-ads:[SDK version]'

Then your app module build.gradle shall involve such line inside the Dependencies component:

dependencies {
   implementation fileTree(include: ['*.jar'], dir: 'libs')

Next, synchronize the Gradle project. Such action is needed to get a Dependency uploaded by the build scheme.

You’ll need to remove [SDK version] replacing it by a numeral of the up-to-date SDK edition. One could also upload the newest SDK as a jar file to execute the action manually:

dependencies {
   implementation fileTree(include: ['*.jar'], dir: 'libs')

When applying AndroidStudio, you’re free to include dependencies via the menu. Simply go to the Project Structure, search for a specific app in the Modules’ tab, look for a Dependencies one, select jar Dependency. After that just determine specific directions for locating uploaded jar files.

Stage 3.

You’re to connect GooglePlay Services by adding them into build.gradle dependencies:

   compile '[lib version]'   
   compile '[lib version]'
   compile '[lib version]'
   compile '[lib version]' 

Obviously, you shall mention a specific version applied instead of [lib version].

Also, include such a component into your app manifest:

<meta-data android:name=""
android:value="@integer/google_play_services_version" /> 

Moreover, you shall get below-mentioned permissions for:

  • connecting to the network and uploading InMobi ads:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
  • applying Geo-Targeting:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  • enjoying multimedia ads:
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


The Picasso library shall also be added into dependencies since the service needs them for picture processing:

dependencies {
   implementation 'com.squareup.picasso:picasso:[lib version]'

And [lib version] has to be replaced by the proper one.

Stage 4.

It’s time for managing the initialization, as well as the service usage in your app. Specific onCreate technique represents the most appropriate solution for achieving the desired. Firstly, we build a JSONObject object stuffing one with required characteristics:

val params = JSONObject()

For specifying the presences or absences of permissions for customers’ details collection and usage, InMobiSdk.IM_GDPR_CONSENT_AVAILABLE has to be added. Then the characteristic might be either true or false indicating permissions’ presence or absence:

params.put(InMobiSdk.IM_GDPR_CONSENT_AVAILABLE, true);

Next, we’re specifying if GDPR provision is used by including the GDP characteristic – where “0” is for YES, “1” is for NO – into the initialization parameter:

params.put("gdpr", "0");

Now we start the initialization by means of the key obtained after registration:

InMobiSdk.init(this, "Insert InMobi Account ID here", params);

Here, “this” refers to the Application.

Stage 5.

The right time is for dealing with extra settings.

In case you are eager to apply GeoTargeting, you’ll have two approaches to do so:

  1. automatic receival of users’ geolocation;
  2. manual transferring of users’ locations via the admin panel.

If specifying locations by yourself, we recommend to apply one of such options:

  • transferring the location:
  • transferring only three components (city, region, country):

The targeting by other parameters, like, age or gender, is applicable as well.

  • determining users’ gender:

There would be InMobiSdk.Gender.MALE and InMobiSdk.Gender.FEMALE constant values.

  • determining the age of users:

Only the integers shall be applied here.

Such interval could be used for gender specifying:


As to interval values, you could apply one of the below-mentioned:

  • BELOW_18
  • BETWEEN_18_AND_24
  • BETWEEN_25_AND_29
  • BETWEEN_30_AND_34
  • BETWEEN_35_AND_44
  • BETWEEN_45_AND_54
  • BETWEEN_55_AND_65
  • ABOVE_55

Moreover, there exist more characteristics for determining your demographics:


Stage 6.

For dealing with InMobi advertising, the placement ID is required. You can obtain it after putting the ads type into the admin panel.

Stage 7.

Let’s integrate diverse ad types into your app.

Interstitial Ad

Aforementioned ads displaying, we’ll have to make a corresponding InMobiInterstitial class instance:

 val interstitialAd by lazy {

The given class uses such values as its parameters:

  • context;
  • placement ID for a specific ad type (taken from the console);
  • InterstitialAdEventListener instance in which we’re overriding one of the methods according to what we’re looking for:
  • onAdLoadSucceeded
  • onAdLoadFailed
  • onAdDisplayed
  • onAdDismissed
 val interstitialAdEventListener: InterstitialAdEventListener = object : InterstitialAdEventListener() {
   override fun onAdLoadSucceeded(ad: InMobiInterstitial?) {
   override fun onAdLoadFailed(p0: InMobiInterstitial?, p1: InMobiAdRequestStatus?) {
   override fun onAdDisplayed(ad: InMobiInterstitial?) {
   override fun onAdDismissed(p0: InMobiInterstitial?) {

When the required classes are launched, and listener approaches are re-considered according to the application behavior, it is time for calling the load () method in order to upload ads:


You could easily keep track of the loading process in the listener class instance which you established by means of such methods:

  • onAdLoadSucceeded
  • onAdLoadFailed

Once receiving a callback to acknowledge the ads loading completion, we’ll call the show () method for showing it:

Native Content Advertising

Such ads type shall not be ignored. First of all, you design a Native Content Ad, and then you’re free to customize it. Initially, you can choose the content type to display – only video, only pictures, or video & pictures.

Next, you’re choosing one of the following subtypes:

  • Preroll
  • Feed
  • Splash
  • Other (for the Chinese audience)

While customizing the layout, a Native Content Ad provides 4 ratios on the admin panel to select from.

While customizing the layout, a Native Content Ad provides 4 ratios on the admin panel to select from.

After transposing specific width’s values you’d like (in pixels) to the SKD, it will return the finalized View including the ad content. The height will comply with a specified ratio.

That’s a trustworthy technique to customize the ad View for different sizes. We applied it for putting the ad into one of the three-columns RecyclerView cells by means of the GridLayoutManager. Regretfully, existing ratios suite-only oblong formats, therefore, we’ve chosen the 1:1 alternative, cos it turned out to be the most appropriate for the case we had.

After finishing the key settings in the admin, you’re good to begin coding. To start with, we shall get an InMobiNative class object:

 val inMobiNativeAdListener = object : NativeAdEventListener() {
   override fun onAdLoadSucceeded(ad: InMobiNative) {

   override fun onAdLoadFailed(ad: InMobiNative, status: InMobiAdRequestStatus)  {
val inMobiNativeAd by lazy {
   InMobiNative(this, INMOBI_NATIVE_PLACEMENT_ID, inMobiNativeAdListener)

Then you call the load () method from the obtained object for downloading the info from a server:

fun addNativeAdView(ad: InMobiNative) {

That’s it – your ads shall be displayed with the proper height and width.

Applying received objects of the InMobiNative class, you can easily obtain title, ad icon, landing page link, etc. Obviously, you can also call the method for going to the landing page.

We’ve introduced our InMobi Integration Guide, which, hopefully, you will find valuable.

Some of the link on this post may have affiliate links attached. Read the FTC Disclaimer.