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.
 

sorex

Expert
Licensed User
Excellent! Thanks!


Edit:

tested it and the error is gone altho it doesn't display the ad due to a "time out waiting for adapter" error.

5.3.1 still displays the ads so I will currently stick with this while my testing goes on.
 
Last edited:

Davin

Member
Licensed User
Excellent! Thanks!


Edit:

tested it and the error is gone altho it doesn't display the ad due to a "time out waiting for adapter" error.

5.3.1 still displays the ads so I will currently stick with this while my testing goes on.
just see this one. and yes. 5.3.1 working super well.. thanks erel
 

tufanv

Expert
Licensed 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
I dont think we can use facebook ads because for facebook to start the app review , you need to click on a test ad to send a ad request. And to be able to see an ad you have to be the developer or tester of the app and I think that is impossible because you have to add the account for developer or tester from the facebook console and adding a person from facebook to developers or testers is ok but how will my app understand that i am that person and show me test ads ? I dont think this is possible if anyone has an idea about it I would love to hear them.
 

tufanv

Expert
Licensed User
I dont think we can use facebook ads because for facebook to start the app review , you need to click on a test ad to send a ad request. And to be able to see an ad you have to be the developer or tester of the app and I think that is impossible because you have to add the account for developer or tester from the facebook console and adding a person from facebook to developers or testers is ok but how will my app understand that i am that person and show me test ads ? I dont think this is possible if anyone has an idea about it I would love to hear them.
after long tries , I successfully mediated with facebook also. After I confirm all working , I will prepare a short tutorial for the people who may want to meiate wit fb.
 

Descartex

Well-Known Member
Licensed User
Hi.
I´ve followed this tutorial to implement rewarded videos on my app.
It shows videos and receive the reward on the app, also AdMob shows me the report but InMobi stills empty...
It is weird...
Thanks a lot.
 

Ferdari

Active Member
Licensed User
Can you explain how to mediate with Unity Ads, i put two AAR but there is no JAR:
B4X:
#AdditionalJar: unity-ads-3.0.1.aar
#AdditionalJar: unity-3.0.0.1.aar

On tutorial it don't say to put something on manifest:
https://developers.google.com/admob...y#step_3_import_the_unity_ads_sdk_and_adapter

There are Requests registered but no impressions

Do i need to add more to the Manifest?? or maybe im missing a JAR. Please help @Erel

I see these Activities on aar file, it are missing on the Manifest from my compiled on my app:
B4X:
<activity
            android:name="com.unity3d.services.ads.adunit.AdUnitActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:hardwareAccelerated="true"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
        <activity
            android:name="com.unity3d.services.ads.adunit.AdUnitTransparentActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:hardwareAccelerated="true"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
        <activity
            android:name="com.unity3d.services.ads.adunit.AdUnitTransparentSoftwareActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:hardwareAccelerated="false"
            android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
        <activity
            android:name="com.unity3d.services.ads.adunit.AdUnitSoftwareActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:hardwareAccelerated="false"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
Do i need to add it?

UPDATE: IT WORKS! ;), add the above Unity Activities to the MANIFEST it now will show Unity Ads.
 
Last edited:
Top