Android Tutorial AdMob Mediation (with InMobi)

AdMob supports ads mediation. This means that the ad can come from different ad networks and not just from Google AdMob network.

It can improve the fill rate and the revenue earned.

upload_2016-9-26_16-13-44.png


You should first start with the standard FirebaseAdMob implementation: https://www.b4x.com/android/forum/threads/67710/#content
Once it works you can continue with adding support for more networks.

Overall it is quite simple to add this feature. The most important tips:

1. Monitor the unfiltered logs (you must use USB debug mode for this) to see any errors.
2. It takes several hours for changes to be applied.

The steps required to add support for a network that is supported by AdMob (list of supported networks):
1. Register with the network.
2. Follow their specific instructions. You will need to add some declarations with the manifest editor.
In the case of InMobi: https://support.inmobi.com/monetize/mediation-guidelines/admob/android-admob-guidelines
B4X:
AddApplicationText(
<activity
android:name="com.inmobi.rendering.InMobiAdActivity"
android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
android:hardwareAccelerated="true" />
)
Check the generated Objects\AndroidManifest.xml file if you are not sure whether you added it correctly or not.

3. You will need to download the network SDK and adapter jar, copy them to the additional libraries folder and add a reference to those libraries in your project. For example:
B4X:
#AdditionalJar: libadapterinmobi
#AdditionalJar: InMobi-5.3.1
4. The additional source should be listed in AdMob under the unit:

SS-2016-09-26_16.28.27.png


That's all. The code itself is exactly the same.
 

asales

Expert
Licensed User
Longtime User
Very nice!

I can use the same example to Facebook Ad Network?
Because I found only this file in Facebook SDK:
facebook-android-sdk-4.15.0.aar
 
Last edited:

sorex

Expert
Licensed User
Longtime User
there are also SDK less ad providers. they don't require any code/manifest change since you just need to enable it in the admob console.

not sure if they (the SDK less) increase earnings tho.

I enabled it once and turned it back off after a day, later I found some stats about it tho so it appears to work.
 
Last edited:

susu

Well-Known Member
Licensed User
Longtime User
B4X:
#AdditionalJar: libadapterinmobi

Where I can find this lib? If I want to use other networks, I need other adapter libs, right?
 

sorex

Expert
Licensed User
Longtime User
does the app grow a lot in size when adding these extras ?
 

sorex

Expert
Licensed User
Longtime User
Is or will this feature (rewarded mediation ads) be available for B4i (hosted) aswell?
 

sorex

Expert
Licensed User
Longtime User
excellent, thanks!

just wondering...

what happends if you enable this mediation and current deployed apps don't have the sdk integrated yet?

will that

crash the app ?
skip the mediation ad and show nothing?
only receive ads from admob?
 

Douglas Farias

Expert
Licensed User
Longtime User
hi @Erel
a simple question, later making this steps i need create account on inmobi?
example: if i show ad from inmobi the cash go to admob? or i need create a account at inmobi and see the cash of inmobi on inmobi website?

thx
 

sorex

Expert
Licensed User
Longtime User
beware that you might lose a lot of impressions untill they approved your account.

you'll see that the mediation has a pending status in admob but it already requests ads but it doesn't return any.
 

Davin

Member
Licensed User
Longtime User
beware that you might lose a lot of impressions untill they approved your account.

you'll see that the mediation has a pending status in admob but it already requests ads but it doesn't return any.
you mean .. i will get admob error : 3

no fill ads ?
 

sorex

Expert
Licensed User
Longtime User
I don't know, when I tested it only my local version had the sdk integrated but it kept sending ad requests to the other network.

I only got admob ads myself tho.

Others might have got nothing at all (which they probably liked ;) )
 

sorex

Expert
Licensed User
Longtime User
an update...

4-5 days later admob still shows pending.

on my support case from 4-5 days ago about this pending status I still didn't receive an answer either.
 
Top