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: 177
  • B4XPagesMobileAds.zip
    18.8 KB · Views: 153

amidgeha

Active Member
Licensed User
After MobileAds_Ready
onConsentInfoUpdateFailure: Invalid response from server: Failed to read publisher's account configuration; try again later., code: 1
Consent: UNKNOWN
 

kisoft

Well-Known Member
Licensed User
I am trying to compile an example but I get this error:

B4X:
Maven artifact not found: com.google.android.ump / user-messaging-platform
 

angel_

Well-Known Member
Licensed User
I am trying to compile an example but I get this error:
B4X:
Maven artifact not found: com.google.android.ump / user-messaging-platform
Add this
B4X:
#AdditionalJar: com.google.android.ump:user-messaging-platform
 

kisoft

Well-Known Member
Licensed User
@angel ...
This is already added in the example ... I think I need to remove the SDKs and get new ones ...
 

SMOOTSARA

Active Member
Licensed User
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
View attachment 115211

Hi
How can I get the following methods for AppOpens?



b4a:
'Sub OpenAd_onAppOpenAdLoaded
'Sub OpenAd_onAppOpenAdFailedToLoad(ErrorCode As Int)
'Sub OpenAd_onAdShowedFullScreenContent
'Sub OpenAd_onAdDismissedFullScreenContent
 

asales

Well-Known Member
Licensed User
The two firsts events has code in the class.
To the anothers you need to change the class with the respective java code.
B4X:
Sub OpenAd_ReceiveAd

Sub OpenAd_FailedToReceiveAd (ErrorCode As String)
 

SMOOTSARA

Active Member
Licensed User
The two firsts events has code in the class.
To the anothers you need to change the class with the respective java code.
B4X:
Sub OpenAd_ReceiveAd

Sub OpenAd_FailedToReceiveAd (ErrorCode As String)

Hi, this is exactly the problem I do not know about "Java code"
 

asales

Well-Known Member
Licensed User
... I do not know about "Java code"
Time to learn.
Check the java code in the class and the documentation to the AppOpenAd ads.
The java code to ReceiveAd/AdLoaded has 2 lines and I think that will be simple to make the changes.
And you could create a thread with your doubts about the code.
 
Top