Android Tutorial AdMob Mediation (with InMobi)

Discussion in 'Tutorials & Examples' started by Erel, Sep 26, 2016.

  1. Erel

    Erel Administrator Staff Member Licensed User

    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
    Code:
    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:
    Code:
    #AdditionalJar: libadapterinmobi
    #AdditionalJar: InMobi-5.3.1
    4. The additional source should be listed in AdMob under the unit:

    [​IMG]

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

    asales Active Member 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
     
    Last edited: Sep 26, 2016
  3. Erel

    Erel Administrator Staff Member Licensed User

    asales likes this.
  4. sorex

    sorex Expert Licensed 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: Sep 27, 2016
  5. susu

    susu Well-Known Member Licensed User

    Code:
    #AdditionalJar: libadapterinmobi
    Where I can find this lib? If I want to use other networks, I need other adapter libs, right?
     
  6. susu

    susu Well-Known Member Licensed User

  7. sorex

    sorex Expert Licensed User

    does the app grow a lot in size when adding these extras ?
     
  8. DonManfred

    DonManfred Expert Licensed User

    i guess yes
     
    susu likes this.
  9. Erel

    Erel Administrator Staff Member Licensed User

    The size increase will be similar to the size of the jars. In the case of InMobi it is about 500kb.

    You don't really need to create a wrapper. Only to compile this java code.
     
  10. sorex

    sorex Expert Licensed User

    Is or will this feature (rewarded mediation ads) be available for B4i (hosted) aswell?
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    Yes, I plan to add support for InMobi. This month is a bit slower due to endless holidays...
     
  12. sorex

    sorex Expert Licensed 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?
     
  13. Erel

    Erel Administrator Staff Member Licensed User

    You will need to test it.
     
  14. Douglas Farias

    Douglas Farias Expert Licensed 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
     
  15. Erel

    Erel Administrator Staff Member Licensed User

    Yes.

    You will collect the money from InMobi.
     
    Douglas Farias likes this.
  16. sorex

    sorex Expert Licensed 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.
     
  17. Davin

    Davin Member Licensed User

    you mean .. i will get admob error : 3

    no fill ads ?
     
  18. sorex

    sorex Expert Licensed 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 ;) )
     
    Douglas Farias likes this.
  19. sorex

    sorex Expert Licensed 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.
     
    yousif likes this.
  20. Davin

    Davin Member Licensed User

    Same here.. still pending
     
Loading...