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: 463
Last edited:

tufanv

Expert
Licensed User
Longtime User
Yeah i did not see that our apps can remain =) Thank you for clarification and good luck with the update =)
 

Johnmcenroy

Active Member
Licensed User
Longtime User
I have updated MoPub library to 4.6.1. Normally I am testing all ad networks one by one with the new release of MoPub and update all ad networks SDK's and adapters, but v4.6.1 is only simple update to new MoPub SDK. There are a lot of changes and I must rearrange my project structure. Sorry for such a "in short time" update. I will try to make project to become up to-date with MoPub SDK versions.

P.S. To update simply copy jar files from 4.6.1.zip archive to your additional B4A libs folder.

Regards
John
 

tufanv

Expert
Licensed User
Longtime User
I am getting this: Any ideas ?
B4X:
LogCat connected to: B4A-Bridge: samsung SM-T230
--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
Installing file.
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Connected to B4A-Bridge (Wifi)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Installing file.
Installing file.
PackageAdded: package:ct.airlineboss
Installing file.
PackageAdded: package:ct.airlineboss
Copying updated assets files (94)
** Activity (main) Create, isFirst = true **
java.lang.NoClassDefFoundError: android.support.v4.content.ContextCompat
    at com.mopub.common.util.DeviceUtils.isPermissionGranted(DeviceUtils.java:257)
    at com.mopub.mraid.MraidNativeCommandHandler.isStorePictureSupported(MraidNativeCommandHandler.java:143)
    at com.mopub.mobileads.AdViewController.<init>(AdViewController.java:101)
    at com.mopub.mobileads.factories.AdViewControllerFactory.internalCreate(AdViewControllerFactory.java:21)
    at com.mopub.mobileads.factories.AdViewControllerFactory.create(AdViewControllerFactory.java:17)
    at com.mopub.mobileads.MoPubView.<init>(MoPubView.java:74)
    at com.mopub.mobileads.MoPubView.<init>(MoPubView.java:48)
    at com.mopub.mobileads.MoPubInterstitial$MoPubInterstitialView.<init>(MoPubInterstitial.java:222)
    at com.mopub.mobileads.MoPubInterstitial.<init>(MoPubInterstitial.java:50)
    at com.mopub.Interstitial.InitializeMopub_Interstitial(Interstitial.java:20)
    at ct.airlineboss.main._activity_create(main.java:1355)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at ct.airlineboss.main.afterFirstLayout(main.java:102)
    at ct.airlineboss.main.access$000(main.java:17)
    at ct.airlineboss.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5602)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for ct.airlineboss
Subscriptions AVAILABLE.
libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Connected to B4A-Bridge (Wifi)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Installing file.
libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
** Activity (main) Create, isFirst = false **
running waiting messages (5)
** Activity (main) Resume **
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
Installing file.
PackageAdded: package:ct.airlineboss
** Activity (main) Create, isFirst = true **
java.lang.NoClassDefFoundError: android.support.v4.content.ContextCompat
    at com.mopub.common.util.DeviceUtils.isPermissionGranted(DeviceUtils.java:257)
    at com.mopub.mraid.MraidNativeCommandHandler.isStorePictureSupported(MraidNativeCommandHandler.java:143)
    at com.mopub.mobileads.AdViewController.<init>(AdViewController.java:101)
    at com.mopub.mobileads.factories.AdViewControllerFactory.internalCreate(AdViewControllerFactory.java:21)
    at com.mopub.mobileads.factories.AdViewControllerFactory.create(AdViewControllerFactory.java:17)
    at com.mopub.mobileads.MoPubView.<init>(MoPubView.java:74)
    at com.mopub.mobileads.MoPubView.<init>(MoPubView.java:48)
    at com.mopub.mobileads.MoPubInterstitial$MoPubInterstitialView.<init>(MoPubInterstitial.java:222)
    at com.mopub.mobileads.MoPubInterstitial.<init>(MoPubInterstitial.java:50)
    at com.mopub.Interstitial.InitializeMopub_Interstitial(Interstitial.java:20)
    at ct.airlineboss.main._activity_create(main.java:1355)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at ct.airlineboss.main.afterFirstLayout(main.java:102)
    at ct.airlineboss.main.access$000(main.java:17)
    at ct.airlineboss.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5602)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    at dalvik.system.NativeStart.main(Native Method)
 

tufanv

Expert
Licensed User
Longtime User
Hi tufanv. Thanks for kind words. It seems that there is no support v4 library in your project or you need to update it.
I added v4 support but i am still getting this error. I alslo couldnt find mopub valley .jar as in the example ? where can i find the jar
 

chuath

Member
Licensed User
Longtime User
First of all, thanks Johnmcenroy for updating this lib.

I've tried the new version and found out that the banner listener was not been fired.
"*eventname*_mopub_banner_clicked"

This was based on old version's example. I wonder if there is any changes to this in new version.
"*eventname*_mopub_banner_loaded" works by the way.
 

tufanv

Expert
Licensed User
Longtime User
I also tested the demo project and i still keep getting
java.lang.NoClassDefFoundError: android.support.v4.content.ContextCompat

I added all the jars , support v4,v7 everything but no luck :/
 

tufanv

Expert
Licensed User
Longtime User
I have a problem. I can get the interstitial loaded log but i cant show the ad. Nothing happens. Am i missing stg ?
 

yousif

New Member
Licensed User
Longtime User
could you update new example for me ?
contains all external library ...
is this library work B4A 6.00 ?!
 
Top