Android Question AdMob Help Please

German Buchmuller

Member
Licensed User
Longtime User
Hi, I implemeted admob by downloading the google play services, copying the jar file to the libraries. I also added "#AdditionalRes: C:\sdk\extras\google\google-play-services\libproject\google-play-services_lib\res, com.google.android.gms" to project attributes.

then, I created a scratch app with the following code:

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim AdView1 As AdView
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("Layout1")
AdView1.Initialize("Ad", "MY_ID")
Activity.AddView(AdView1, 0dip, 0dip, 320dip, 50dip)' AdView1.LoadAd 'loads an ad
AdView1.LoadAd
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Ad_FailedToReceiveAd (ErrorCode As String)
Log("failed: " & ErrorCode)
End Sub
Sub Ad_ReceiveAd
Log("received")
End Sub
Sub Ad_AdScreenDismissed
Log("screen dismissed")
End Sub

I get the log "recieved", but no add or anything appears. Any solutions? Thankss!!!
 

DonManfred

Expert
Licensed User
Longtime User
1. Use code tags when posting code!
2. Which B4A Version are you using?
 
Upvote 0

German Buchmuller

Member
Licensed User
Longtime User
Hi, how can I use code tags? Im new with this!

I am usig B4A 5.80

Thanks!
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

German Buchmuller

Member
Licensed User
Longtime User
Hi, here you have the example app. Thanks for all the advice!
 

Attachments

  • example.zip
    7.1 KB · Views: 179
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Thanks for all the advice!
As far i see you forget to include this to your manifest.

B4X:
'AdMob
AddApplicationText(
<activity android:name="com.google.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
)
'End of AdMob

Additional you are not using
B4X:
Sub Activity_Resume
    AdView1.Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    AdView1.Pause
End Sub

It does not show any ad here too... Dont know any more answer/help.
Maybe someone other may help.

Please note that when you update to b4a 6 then you are forced to switch to firebaseads (suggested)
 
Upvote 0
Top