Android Question Tapping on ads does not work

svmenifee

Member
I have gone through the hoops to implement AdMob ads with the FirebaseAdMob library. I have ads displaying in the app and the AdMob dashboard shows some impressions, so it seems to be implemented correctly. However, tapping on the ads has no effect - there is a flash on the ad background indicating a tap is detected, but no browser window opens for the ad destination. This is true for all ads in the app, in either debug or release mode, and tested both on a phone and on the BlueStacks emulator.

I must have missed a step somewhere but have no clue what it is, and my googling on this subject has not brought joy. Any ideas?
 

svmenifee

Member
Thank you for the response. Here is a summary of my experience for the benefit of others.

Although in the end everything was already configured properly, it was impossible to tell for quite some time, and that lack of knowing led to considerable time wasted in experimentation. I found the following after having tested a sample ad successfully and after having set up an AdMob account correctly:

- For several hours, error code 0 (invalid server response) was returned by BannerAd_FailedToReceiveAd.
- Then, despite no change in code or AdMob account, for several hours error code 3 (no ad due to lack of inventory).
- Then, despite no change in code or AdMob account, for several hours ads were displayed but would not respond to touch.
- Then, despite no change in code or AdMob account, touching an ad resulted in a crash dump.

The crash dump gave a hint with a reference to "AdActivity" and following some searching I added the following to the Manifest Editor:

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

Once this was done, the response to touching an ad was handled correctly and everything is good. So the bottom line is that most of the confusion comes from AdMob's delays in getting things flowing on their end, and their dashboard gives no indication of any problem, issue, or delay.

To summarize, the following lines are the total of what I added to Manifest Editor for AdMob. This information was gleaned from various threads of this forum. Only the first item is needed to successfully test a sample ad. The rest was needed to get real ads to work. This is only for banner ads - I haven't tried to tackle any other types yet.

B4X:
AddReplacement($ADMOB_APP_ID$, ca-app-pub-xxxxxxxxxxxxxxxxxxxxxx~xxxxxxxxxx)
AddApplicationText(
<meta-data android:name="com.google.android.gms.version"
  android:value="@integer/google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
 
Upvote 0
Top