1. Register with Tappx and get an app key: https://www.tappx.com
2. Download their AAR library and copy it to the additional libraries folder: https://repo1.maven.org/maven2/com/tappx/sdk/android/tappx-sdk/3.1.3/
3. Add dependencies:
4. Add to manifest editor:
Replace CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase) with the snippet from firebase integration tutorial if using an older version of B4A.
5. Code, make sure to update the key:
Depends on JavaObject.
2. Download their AAR library and copy it to the additional libraries folder: https://repo1.maven.org/maven2/com/tappx/sdk/android/tappx-sdk/3.1.3/
3. Add dependencies:
B4X:
#AdditionalJar: tappx-sdk-3.0.9.aar
#AdditionalJar: com.google.android.gms:play-services-ads
4. Add to manifest editor:
B4X:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddApplicationText(
<!-- Tappx Activities -->
<activity
android:name="com.tappx.sdk.android.AdActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name="com.tappx.sdk.android.InterstitialAdActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="@style/Transparent" />
<activity
android:name="com.tappx.sdk.android.VideoAdActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<service android:name="com.tappx.sdk.android.TrackInstallIntentService" />
<!-- AdActivity from Google Play Services,, needed by Tappx -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
)
5. Code, make sure to update the key:
B4X:
Sub Globals
Private const TappxKey As String = "Pub-8888-Android-6456"
Private banner As JavaObject
End Sub
Sub Activity_Create(FirstTime As Boolean)
CreateBanner(TappxKey)
Activity.AddView(banner, 0, 0, 320dip, 50dip)
End Sub
Sub CreateBanner (key As String)
Dim banner As JavaObject
Dim ctxt As JavaObject
ctxt.InitializeContext
banner.InitializeNewInstance("com.tappx.sdk.android.TappxBanner", Array(ctxt, key))
banner.RunMethod("setAdSize", Array("BANNER_320x50"))
banner.RunMethod("loadAd", Null)
Dim listener As Object = banner.CreateEventFromUI("com.tappx.sdk.android.TappxBannerListener", "ad", Null)
banner.RunMethod("setListener",Array(listener))
End Sub
Sub Ad_Event (MethodName As String, Args() As Object) As Object
Dim argsList As List = Args
Log(MethodName & ": " & argsList)
Return Null
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
If banner.IsInitialized Then
banner.RunMethod("destroy", Null)
End If
End If
End Sub
Depends on JavaObject.
Last edited: