B4A Library MoPub Ad Server Library (Updated to v4.6.1 , 29 May 2016) - 20+ ad networks (AdMob , etc.)

mopub_logo.png

Library (Updated to v4.6.1 , 29 May 2016)
MoPub Official Website
Google Play Policies
MoPub is the world largest mobile ad server (mediation platform) and RTB exchange (MoPub marketplace). Now it belongs to Twitter. It is the main competitor to AdMob , but MoPub primary focus is mediation of ads. The following ad networks work just right out of the box:
MoPubLibVer.png

support.PNG
All networks are tested and use official java code of these networks.
AdColony can use only interstitial or rewarded video, if you will use both in your project - it will not work.
Tapjoy - please test, integration is rather complicated, so for now I didn't test it myself, but normally it should work.
Native ads are not supported for now.
Note: I advise you to use logcat logs in B4A (without filter checked) or this standalone utility to see all error codes and a lot of additional info about loading your ads.

Please vote for ad network you want to see in MoPub Library


ChangeLog:
v4.6.1 29.05.2016
v4.2 30.11.2015

Updated:
MoPub SDK v4.2 (Nov 30,2015)
All ad networks SDK's and code
Syntax of using library is changed a little
Added:
Rewarded video ads
Amazon ads
Tapjoy
Unity ads

v2.3 22.07.2014
Updated:
MoPub SDK v2.3 (Jul 17, 2014)
All ad networks SDKs
Added:
mNectar
MobileCore
Facebook
AdColony
Vungle
StartApp
Leadbolt

v2.1 02.12.2013
Added:
AppLovin (banners and interstitials)
Greystripe (banners and interstitials)
Chartboost (interstitials)

v2.0 28.11.2013
Added :
Banners and interstitials listeners
Interstitials' preload - now all works really fast
Integrated AppBrain and TapForTap
(both banners and interstitials)
Updated:
MoPub SDK v1.17 (Nov 20, 2013)
Appbrain SDK v9.2
TapForTap SDK v3.0.7
Fixed:
Interstitial's close button
Almost totally rewrited library

v1.1 16.06.2013
Added:
Interstitial ads

Roadmap:
Add support for Madvertise , RevMob , AppNext , Inneractive , TapContext , Amazon Ads , Flurry , MobPartner , MDotm
Note: possibly to make wrapper for MobFox as alternative to MoPub , because as from May 14, 2014 their SDK supports custom events to integrate other networks SDK , also maybe wrapper for mAdserve as self-hosting solution for mediating ads.


Tags: MoPub , MobFox , Mojiva , Lifestreet media , Hunt mobile ads , Tapit , AdMob , Millennial Media , Inmobi , Chartboost , Greystripe , AppBrain , TapForTap , MobileCore , AppLovin , Leadbolt , Facebook , AdColony , Vungle , StartApp , mNectar , Ad Network Library

Links:
MoPub B4A v4.6.1 update (Updated 29 May 2016)
MoPub B4A Library v4.2 Additional SDK's (Updated 30 November 2015)
I have included demo project with all listener methodes. You can compile that project with default id's to test ads.
Also I have written detailed but simple as possible guide to integrate all of the networks and general help how to use MoPub.
Soon I will update guide and published it, for now please see demo project.

Good luck !
Regards
John


 

Attachments

  • MoPub B4A Library v4.2.zip
    451.5 KB · Views: 566
Last edited:

Johnmcenroy

Active Member
Licensed User
Longtime User
Hi John

Any chance of an update, to the newest SDK?
I heard from a friend, that his income increased a lot, with the new SDK

Kind regards
Jakob

Hi Jacob
I will update MoPub SDK to 2.2 this week. Also I will add more networks and guide for simple integration of all networks.

Regards
John
 

Johnmcenroy

Active Member
Licensed User
Longtime User
These are Mopub stats for this interstitial banner

Requests Impressions Fill Rate
931 4 0.43%

Does it mean I only need to add more networks so my fill rate is higher?

Hi Jalle
In MoPub there is their own ads - MoPub Marketplace (include RTB exchange) , but better to add more networks for different regions. I will update this week to MoPub new SDK 2.2 and write guide for simple integration of various ad networks.

Regards
John
 

deltacode

Member
Licensed User
Longtime User
Love your wrapper for this and been awaiting the latest update.

I cant find the link on the first page though :(
 

Johnmcenroy

Active Member
Licensed User
Longtime User
Love your wrapper for this and been awaiting the latest update.

I cant find the link on the first page though :(

Happy that you liked it. I will update all info and links for download today. I will publish detailed but simple as possible guide to integrate all networks and how to use MoPub in general.

Regards
John
 

Johnmcenroy

Active Member
Licensed User
Longtime User
Finally MoPub library is updated with new MoPub SDK v2.3 (17 July 2014) , new ad networks (overall there is support of more than 20 ad networks for now including AdMob (banners & interstitials)) , simple integration guide and general help how to use MoPub. Hope it is simple guide :)
 
Last edited:

canalrun

Well-Known Member
Licensed User
Longtime User
Thanks. It looks useful.

I have two questions though.

1) I use mainly banner ads. Admob has three banner ad sizes; 728 x 90, 468 x 60, and 320 x 50. Amazon has two banner ad sizes; 600 x 90, and 320 x 50. Can these different size banners be accessed via the library?

2) How does MoPub get paid? Do they take a cut from your earnings?

2.5) Does MoPub automatically arbitrate the highest paying ad network to fill each individual ad request?

Thanks,
Barry.
 

Johnmcenroy

Active Member
Licensed User
Longtime User
Thanks. It looks useful.

I have two questions though.

1) I use mainly banner ads. Admob has three banner ad sizes; 728 x 90, 468 x 60, and 320 x 50. Amazon has two banner ad sizes; 600 x 90, and 320 x 50. Can these different size banners be accessed via the library?

2) How does MoPub get paid? Do they take a cut from your earnings?

2.5) Does MoPub automatically arbitrate the highest paying ad network to fill each individual ad request?

Thanks,
Barry.
Hi Barry
1. Normally it doesn't matter what banner's size you use. You can exactly write the size of banner when you add it in MoPub web interface (note:Amazon Ads are not supported for now , I can add it later but only banners).

2. There are two types of earnings in MoPub:
a. MoPub Marketplace - it is their own ads based on RTB exchange , uncluding following companies , here MoPub takes 40% as any other ad network do (20-40% , including AdMob. Note: usually user don't know this info - it is contract terms between advertiser and company such as MoPub or AdMob). MoPub payment terms - net60 (Payment will be sent 60 days after the end of the monthly payment period or according to your contract terms. Payment is only sent for balances over $100).
b. Networks mediation - it is all the networks that you add to MoPub (AdMob , Inmobi , AppBrain , etc.) and it is completely free , MoPub takes nothing , all these networks pay you directly , as if you work with them without MoPub.

2.5 Please read more here and here about this.


Regards
John
 
Last edited:

canalrun

Well-Known Member
Licensed User
Longtime User
Thanks. That's really good information.

I must have spent two hours searching their side, but I could not get a complete picture of the details.

I did not see that other ad networks pay you directly – it seemed like MoPub collected the payments then sent them on to you

The ad sizes I use are not static. They are dynamically chosen based on the size of the device on which they are running. I will have to look closer at the library interface.

Do use MoPub and are you happy with it? I can definitely see some advantages.

Barry.
 

Johnmcenroy

Active Member
Licensed User
Longtime User
Thanks. That's really good information.

I must have spent two hours searching their side, but I could not get a complete picture of the details.

I did not see that other ad networks pay you directly – it seemed like MoPub collected the payments then sent them on to you

The ad sizes I use are not static. They are dynamically chosen based on the size of the device on which they are running. I will have to look closer at the library interface.

Do use MoPub and are you happy with it? I can definitely see some advantages.

Barry.

MoPub don't collect your payments - all payment go directly to you from AdMob ,AppBrain , etc. , it is only mediation service not such as Smaato or Axonix (former Mobclix). They only mediate your ads from these ad networks , you enter your data from these networks (App ID , Publisher ID and so on.) You can read it here. They pay only for their MoPub Marketplace.

Think that there will be no problem with this. You add any banner's size you want in MoPub web interface and then can switch between various sizes in your B4A code.

For now I have not a lot of apps with a lot of traffic , but for example for banners I have 1.35 eCPM from MoPub Marketplace (average for one year). I consider this a great service for mediation ads. AdMob mediation also is good , but here there are far more settings . Also heard a lot of info about account ban in AdMob. And here in B4A library I have integrated a lot of networks inside MoPub SDK , for MoPub in java and AdMob you must add them manually one by one.

Regards
John
 

magicuser68

Member
Licensed User
Longtime User
I finally got TapForTap to work with your library, it took me about 5 hours, I used the logcat to figure out most of the issues.
When you have some time I think the instructions should be changed.

The following MUST be added to the end of the manifest for TapForTap BANNER ADS to work:

B4X:
AddApplicationText(
<!-- TapForTap -->
<activity android:name="com.tapfortap.FullScreenAdActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>)
AddManifestText (
<meta-data
  android:name="com.tapfortap.API_KEY"
  android:value="YOUR_API_KEY"/>)   
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_PHONE_STATE)

AddApplicationText(
<!-- MoPub -->
<activity android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation"/>
<activity android:name="com.mopub.mobileads.MraidActivity"
android:configChanges="keyboardHidden|orientation"/>
<activity android:name="com.mopub.common.MoPubBrowser"
android:configChanges="keyboardHidden|orientation"/>
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
android:configChanges="keyboardHidden|orientation"/>
<!-- Google Play Services -->
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />)

In your PDF under "Basic4Android configuration" you are correct about the permissions that you state but TapForTAP also requires ACCESS_WIFI_STATE, WRITE_EXTERNAL_STORAGE and READ_PHONE_STATE. Also, the tapfortap API_KEY needs to be added to the manifest to receive ads.
For the TapForTap instructions in your PDF I would suggest just copying my above code for your number 1 item.

Thank you very much for making the library, you did a great job. I know how much work it takes.
Hopefully this information will help the next guy and save them some time.

Thanks again,

- Scott
 

Johnmcenroy

Active Member
Licensed User
Longtime User
I finally got TapForTap to work with your library, it took me about 5 hours, I used the logcat to figure out most of the issues.
When you have some time I think the instructions should be changed.

The following MUST be added to the end of the manifest for TapForTap BANNER ADS to work:

B4X:
AddApplicationText(
<!-- TapForTap -->
<activity android:name="com.tapfortap.FullScreenAdActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>)
AddManifestText (
<meta-data
  android:name="com.tapfortap.API_KEY"
  android:value="YOUR_API_KEY"/>)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_PHONE_STATE)

AddApplicationText(
<!-- MoPub -->
<activity android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation"/>
<activity android:name="com.mopub.mobileads.MraidActivity"
android:configChanges="keyboardHidden|orientation"/>
<activity android:name="com.mopub.common.MoPubBrowser"
android:configChanges="keyboardHidden|orientation"/>
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
android:configChanges="keyboardHidden|orientation"/>
<!-- Google Play Services -->
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />)

In your PDF under "Basic4Android configuration" you are correct about the permissions that you state but TapForTAP also requires ACCESS_WIFI_STATE, WRITE_EXTERNAL_STORAGE and READ_PHONE_STATE. Also, the tapfortap API_KEY needs to be added to the manifest to receive ads.
For the TapForTap instructions in your PDF I would suggest just copying my above code for your number 1 item.

Thank you very much for making the library, you did a great job. I know how much work it takes.
Hopefully this information will help the next guy and save them some time.

Thanks again,

- Scott

Hi Scott
Thanks for info.
You are right , TapForTap requires two additional permissions:
B4X:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
I have forgot to add them in guide , because in my sample application I have all permissions enabled. I will update it in new version
a little later , including some new networks.

What concerns
B4X:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
, this permission is only highly recommended
for interstitials and video ads. All work without it. Also you don't need to initialize TapForTap through manifest but you can.
There are three types of network initialization for MoPub :
1. Through code , directly to network's SDK
2. Through manifest file
3. Through Custom Event Class Data in MoPub web interface.
Type 3 is native for MoPub and is recommended. All networks that you see in table are tested manually by me (banners & interstitials).

Thanks again and good luck.

Regards
John
 
Last edited:

magicuser68

Member
Licensed User
Longtime User
Another issue I am having which isn't due to the Library but was hoping someone had an answer for.

I get the following error 90% of the time: "MoPubErrorCode: Third-party network failed to respond in a timely manner."

My only ad network is TapForTap, anyone else having timeout issues with them and MoPub? Any suggestions on which party to contact to have this resolved?

Thanks,

- Scott
 

Johnmcenroy

Active Member
Licensed User
Longtime User
Another issue I am having which isn't due to the Library but was hoping someone had an answer for.

I get the following error 90% of the time: "MoPubErrorCode: Third-party network failed to respond in a timely manner."

My only ad network is TapForTap, anyone else having timeout issues with them and MoPub? Any suggestions on which party to contact to have this resolved?

Thanks,

- Scott

Hi Scott
I have tested again Tap for Tap and it seems that they changed some settings for MoPub.
I see this error just with their sample java application in Eclipse. Also it happens to banners only , interstitials work perfect as with their sample java application and with my library in B4A. I will write to support of Tap for Tap.

Regards
John

P.S. TapForTap configuraion is on page 11 of the guide. I will update it later with new permissions.
 
Last edited:

daniel69

Member
Licensed User
Longtime User
Hi! Using the AppBrain interstitial in the sample project I get the following error:

java.lang.NoClassDefFoundError: android.support.v4.content.LocalBroadcastManager

All the mopub library files of the zip are in the addlibrary folder ... using for development B4A 3.20 and android-19 jar and mobile for testing with android 4.4.2

Any ideas?
 

daniel69

Member
Licensed User
Longtime User
Hi! I get the same error also with AdMob interstitial (the banners are ok in both cases, they work without errors) ...
 

Johnmcenroy

Active Member
Licensed User
Longtime User
Hi! I get the same error also with AdMob interstitial (the banners are ok in both cases, they work without errors) ...

Hi Daniel
Uncomment android_support_v4 in MoPub.xml

Update:
Sorry , it seems that I have forgot to add this line. Add the following:
B4X:
<dependsOn>android-support-v4</dependsOn>
in a bottom of the MoPub.xml file

Regards
John
 
Last edited:
Top