B4A Library FirebaseAdMob v1.6

Status
Not open for further replies.
Google has added a few new requirements to AdMob implementation. You must make these changes if you are using the latest versions of Android SDK libraries (firebase-ads 18.1.1+).

Instructions:
2. Find your AdMob app id and add it to the manifest editor:
B4X:
'This is a sample AdMob app id. You need to change it to your id.
AddReplacement($ADMOB_APP_ID$, ca-app-pub-3940256099942544~3347511713)
How to find the id: https://support.google.com/admob/answer/7356431?hl=en

3. Initialize MobileAds in Service_Create of the starter service:
B4X:
Dim MobileAds As MobileAds
MobileAds.Initialize
4. Open Tools - B4A Sdk Manager and update all the recommended items.

If the app immediately crashes then it is likely that the app id is wrong. Start with the sample app id and then change it to your app id.

Library is included as an internal library.
 
Last edited:

DonManfred

Expert
Licensed User
Use android.jar from platform 28
 

Vincenzo Fabiano

Member
Licensed User
My app don't crash, but i receive always error 3 on ADS. Any solution for this?

B4A: 9.50
FirebaseAdmob Lib: 1.60
JDK Used: 1.8.0_231
Android SDK Used: 28

MANIFEST NEW LINE:

AddManifestText(
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28"/>
<uses-permission android:name="android.permission.READ_DEVICE_STATE" />
<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"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
<uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "Weed Click!")
'End of default text.

' Hardware accelerated
SetApplicationAttribute(android:hardwareAccelerated, "true")

'************ Google Play Services Base ************
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
'************ Google Play Services Base (end) ************

'************ Firebase Base ************
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
'************ Firebase Base (end) ************

'************ Firebase Analytics ************
CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
'************ Firebase Analytics (end) ************

'************ Firebase Ads ************
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)
'************ Firebase Ads (end) ************

AddReplacement($ADMOB_APP_ID$, ca-app-pub-7658264588772772~5928152845)




SERVICE NEW LINE:

Sub Service_Create
'This is the program entry point.
'This is a good place to load resources that are not specific to a single activity.
Dim MobileAds As MobileAds
MobileAds.Initialize


ApriConnessione
End Sub
 
Last edited:
Status
Not open for further replies.
Top