B4A Library AppLovin Ads - Social Advertising

Hi folks,

I present you the AppLovin ad library. This ad type is very new on the scene, and it adds a social element to your ads. It also promises (and I've tested it to be true) a higher eCPM compared to others like Admob and Mobfox.

More details:
http://www.applovin.com/

Here are the manifest requirements:

B4X:
<!-- AppLovin API key. Could be obtained from AppLovin management console -->
        <meta-data
            android:name="applovin.sdk.key"
            android:value="<your key from dashboard here>" />
<!-- This flag enables verbose logging of AppLovin SDK -->
        <meta-data
            android:name="applovin.sdk.verbose_logging"
            android:value="true" />

        
        <service android:name="com.applovin.sdk.AppLovinService" >
            <intent-filter>
                <action android:name="com.applovin.sdk.AppLovinService" />
            </intent-filter>
        </service>

Permissions:

B4X:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
   
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.READ_CONTACTS"/>

**Read contacts permission is optional, but having it in will show you the social ads, otherwise you get non-social ads.

You can create banner ads or interstitial ads. For interstitial, you will need to handle the ad closed event thing. And look at addisplayed event before showing your ads.

I have not truly tested the interstitials much, better thoroughly test it out.

Banners are fine, add as a new view to your panel or activity like you do for Admob.

Attached library includes the dummy xml file for those who work the "classic" way, or for those who have B4A versions prior to 1.8.

Do note that i've noticed the ads are mainly cpa type, meaning, people will need to download the apps advertised before you get your revenue.

Give it a go!

Any questions, ask away.

Cheers!
-Bill
 

Attachments

  • MESAppLovin.zip
    4.6 KB · Views: 439

rleiman

Well-Known Member
Licensed User
Longtime User
OK, I got it



Edit: I got it (again). Need to call al.LoadNextAd :D


Hi,

I tried to add it in Process_Globals but got and error that states "Cannot access activity object from sub Process_Globals"

Did I miss something?

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

    ' Objects.
    '---------
    Dim nNotify As Notification
    Private kvs As KeyValueStore
    Dim al As MESAppLovin
End Sub

And placed this code in Activity_Create

B4X:
Sub Activity_Create(FirstTime As Boolean)
 
    Activity.LoadLayout("Main")

    ' Initialize objects.
    '-------------------- 
    nNotify.Initialize
    sf.Initialize

    al.initialise(False, "al")
    Activity.AddView(al, 0, Activity.Height - 48dip, Activity.Width, 48dip)
    al.LoadNextAd 
End Sub
 

susu

Well-Known Member
Licensed User
Longtime User
As far as I know this wrapper can't work with Applovin SDK anymore. It seems Applovin didn't support B4A too.
 

rleiman

Well-Known Member
Licensed User
Longtime User
Hi susu,

From all of the posts on this thread many b4a developers are using AppLovin and getting paid from it.

Maybe one of them would be able to post the Applovin-sdk.jar file so I can use it as well?

If not, is there an ad service like Applovin that doesn't cost the developer any money?

Thanks.
 

susu

Well-Known Member
Licensed User
Longtime User
I used Applovin long time ago. I earned so much with them. However, after 1 year there's no ads for my country anymore so I changed to another ad network.
They provided wrapper for B4A but they deleted it without any reason, I asked but they never answer.

All ad networks don't charge you to use their service because they need developers. Right now the most profitable network is Startapp then AdBuddiz, AdMob, AirPush, Leadbolt. It's only my opinion. You need to test all of them to find who is the best for you. Good luck.
 

rleiman

Well-Known Member
Licensed User
Longtime User
Hi susu,

I signed up with StartApp and set it up for a test app and found a b4a library but I tried to use it but the banner does not show up. Since you are using StartApp, can you tell me what I'm missing?

In the manifest:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
    )

AddManifestText(
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>)

AddApplicationText(<activity android:name="com.startapp.android.publish.list3d.List3DActivity"
          android:theme="@android:style/Theme" />
<activity android:name="com.startapp.android.publish.AppWallActivity"
          android:theme="@android:style/Theme.Translucent"
          android:configChanges="orientation|keyboardHidden|screenSize" />)   

SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.

In the main module:

B4X:
#Region  Project Attributes
    #ApplicationLabel: StartApp Test
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
 #End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Dim StAppPlus As StartAppPlus
    Private ImageViewExit As ImageView
    Private PanelMenu As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")

    ' Set up the adverts.
    '--------------------
    StAppPlus.Initialize("My ID his here.","My app ID is here.")

    StAppPlus.ShowBanner
    Activity.AddView(StAppPlus,0,(100%y-50dip),100%x,50dip)
End Sub

Sub Activity_Resume

    ' Neatly arrange views.
    '----------------------
    Utils.CenterViewOnBottom(ImageViewExit, PanelMenu, 200)

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub ImageViewExit_Click
    Activity.Finish
End Sub
 

susu

Well-Known Member
Licensed User
Longtime User
Sorry, I'm on mobile so I can't answer you now. When I get my computer I will send you Startapp sample code + library.
 

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Susu,

Thanks for the help. I look forward to the code and library.
 
Top