B4A Class AdsHelper Extension for Traditional B4A apps & more

I wanted to share an update I made to the AdsHelper class and example.

Added:
  • support for rewarded video ads
  • events for rewarded video
  • events for rewarded interstitial
  • events for open ads
  • added parameter for open ads for setting the background delay before allowing the ad to show
  • incorporated native ad example and moved the code into a separate class
  • example of a fixed size banner ad (300x250)
  • support for traditional B4A apps

Modified:
  • code reorganized to make it more readable and easier to follow
1624136473910.png
 

Attachments

  • ActivityAdExample.zip
    19.4 KB · Views: 745
  • B4XPagesMobileAds.zip
    18.8 KB · Views: 679

Sofian

Member
Hi, I try example ads. for activity ads its working fine, and for B4xpage ads its not show any ads.
error log :
error log:
Failed to load RewardedInterstitialAd: {
  "Code": 3,
    "Message": "No ad config.",
     "Domain": "com.google.android.gms.ads",
     "Cause": "null",
    "Response Info": {
    "Response ID": "null",
    "Mediation Adapter Class Name": "",
    "Adapter Responses": []
    }
}
all the same error code: 3 with other ads
 

Sofian

Member
Hi, I try example ads. for activity ads its working fine, and for B4xpage ads its not show any ads.
error log :
error log:
Failed to load RewardedInterstitialAd: {
  "Code": 3,
    "Message": "No ad config.",
     "Domain": "com.google.android.gms.ads",
     "Cause": "null",
    "Response Info": {
    "Response ID": "null",
    "Mediation Adapter Class Name": "",
    "Adapter Responses": []
    }
}
all the same error code: 3 with other ads
I thinks after update B4A.exe to 11.80(64bit) , befote is 11.50 (32bit)
already copy resources_06_21.zip files and commandlinetools-win-6609375_latest.zip and exctract it . My other apps stop showing ads after this with same error
 

Filippo

Expert
Licensed User
Longtime User
Hi,

when executing the procedure "getConsentType" always comes this crash-message.
Is this an bug or is this normal?

B4X:
'Returns one of the following values: NON_PERSONALIZED, PERSONALIZED, UNKNOWN
Public Sub GetConsentType As String
    Dim statuses As Map = CreateMap(1: "NON_PERSONALIZED", 2: "PERSONALIZED", 0: "UNKNOWN")
    Dim status As Int = ConsentInformation.RunMethod("getConsentType", Null)
    Return statuses.GetDefault(status, "UNKNOWN")
End Sub

Crash message:
Error occurred on line: 68 (AdsHelper)
java.lang.RuntimeException: Method: getConsentType not found in: com.google.android.gms.internal.consent_sdk.zzk
 
Top