B4A Library AppBrain - Another monetization option


Active Member
Licensed User
Hi ssg,

Don't know if you can help but I am trying to create AppBrain's BannerListerner library but not sure how to go about doing it.

If you got time, you can check the thread I opened here. May be you can help me :) Thanks


Well-Known Member
Licensed User
Hi tamadon,

I have limited access to the net and pc for the week. So sorry for not being able to respond faster.

I'd recommend you look at the admob code that Erel has posted on these forums on how to handle the event listeners.

The reason this library does not have an event name passed in is because it is not handling any events. :)

Hope you get some good progress.

In the meantime, for those who have access to admob, you can display the appbrain banners via admob.. nad has shared the setup steps here in this thread... look it up...



Licensed User
New AppBrain SDK (June 2013)

Hi! I tried to compile an app with the new AppBrain SDK but it does not work anymore (new methods). I think it needs a new wrapper ....


Active Member
Licensed User
Hi Johnmcenroy

Can you tell my, how to setup MoPub and AppBrain?

Kind regards


Active Member
Licensed User


Well-Known Member
Licensed User
Appbrain is fully complaint with Google Play and has been using the advertising ID since v10.1 released on June 6
Thanks a lot ...i guess this wrapper is woking with the sdk ...from them and not inside the plug in otherwise ...would not be compatible ..
I will take a look ..I hade once account with appbrain I will start over if others are not availlable anymore


Licensed User
Hi All,

I present you another monetization option, AppBrain!

AppBrain is probably more known as a web based Android Market search and analytics thingy.

They actually also provide monetization options, and the results are so far quite good too ( looks better than Admob :D )

AppBrain's SDK shows offerwalls or interstitials to the users to download more (I think they're all FREE) games. Everytime a user downloads and installs games, you make some revenue.

Ok, steps:

1 - Register at Android App Monetization - Advertising & App Monetization with AppBrain

2 - If you cannot access your details yet, you will either need to wait for the confirmation mail from AppBrain or you can try contacting their support.

3 - Download their SDK, it should be named appbrain-sdk-android.jar

4 - Download the attached zip file, and add all the contents plus the SDK from step 3 into your extras folder.

5 - Manifest file, add following before the application close tag:

<!-- AppBrain SDK -->
<activity android:configChanges="keyboard|keyboardHidden|orientation"
    android:name="com.appbrain.AppBrainActivity" />
<service android:name="com.appbrain.AppBrainService" />       
<receiver android:exported="true" android:name="com.appbrain.ReferrerReceiver" >
        <action android:name="com.android.vending.INSTALL_REFERRER" />
6 - Permission required: <uses-permission android:name="android.permission.INTERNET"/>

7 - In your code:

Sub Globals
  Dim ab As MESAppBrain
End Sub

Sub Activity_Create(FirstTime As Boolean)
End Sub
You should initialise the object in your main activity, as the AppBrain's SDK actually records very valuable information which you can access from developer dashboard.

8 - In your code:

Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
   If keycode = KeyCodes.KEYCODE_BACK Then
      Dim xa As Int
      xa = Msgbox2("Download more fun games from AppBrain now!", "More Games!", "Download", "", "Maybe Later", Null)
      If xa = DialogResponse.POSITIVE Then
         ab.showOfferWall 'or showInterstitial
      End If
   End If
   Return False
End Sub
And that's it.

Do note that the developer dashboard is not updated real time.

Some very useful analytics that you can get include daily new installs, daily active users, search terms used to search for your game/app, active versions and a whole lot more!

AppBrain's SDK also makes your app clean looking with no in-game ads and only 1 permission, so you have this option now.

Drawback, I hope they improve the dashboard, as right now it does not show overall revenue summary.

By the way, I have been emailing the co-founder of AppBrain, Uwe Maurer, in regards to the SDK, and he has been very helpful. Hope he'll drop by to further encourage the B4A community.


**** Update 5th April 2012 ****

New version 1.1

Added a new method "alwaysShowInterstitial" which will always show the interstitial (duh! thank you mr obvious!).

This version should also be B4A V1.8 friendly, added the dependson thingy. (Can tell I am no java person eh?)

Back up your stuff before trying this one out.

Good luck!

When I call showinterstitial method i get this at run time

LogCat connected to: X260H1ZG5C227545
--------- beginning of system
--------- beginning of main
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 339)
java.lang.NoSuchMethodError: No interface method showInterstitial(Landroid/app/Activity;)Z in class Lcom/appbrain/AdService; or its super classes (declaration of 'com.appbrain.AdService' appears in /data/app/mtk.engineer.mode.plus-2/base.apk)
at com.madelephantstudios.MESAppBrain.MESABLib.alwaysShowInterstitial(MESABLib.java:48)
at mtk.engineer.mode.plus.main._activity_create(main.java:339)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at mtk.engineer.mode.plus.main.afterFirstLayout(main.java:102)
at mtk.engineer.mode.plus.main.access$000(main.java:17)
at mtk.engineer.mode.plus.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5637)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)