AdMob Ads API
Monetize your Android app with Google AdMob banner and interstitial ads — configuration and JavaScript triggers.
AdMob is a Google service for monetizing mobile apps on iOS and Android platforms. It allows developers to integrate banner, interstitial, and rewarded ads, which are paid by clicks (CPC, Cost-per-Click) or impressions (CPM, Cost-per-Mille). WebViewGold simplifies AdMob integration, enabling quick setup for displaying ads in your WebView-based Android application.
Step 1: Open Config.java File
To begin, open your app's Config.java file to set ad preferences and activate AdMob functionality.
Step 2: Monetize Your App with Native AdMob SDK
In Config.java you can:
- Enable or disable banner and/or interstitial ads by setting
SHOW_BANNER_ADto true for banner ads andSHOW_FULL_SCREEN_ADto true for interstitial ads. - Define intervals for displaying interstitial ads by changing
SHOW_AD_AFTER_Xto the desired number of website interactions before playing an interstitial ad.
Note: Before launching your app, ensure that your unique AdMob IDs are correctly added in the strings.xml file:

Step 3: Enable Rewarded Ads
- Setting Up Rewarded Ads:
- To enable rewarded ads, set
ENABLE_REWARDED_ADStotrue. - Use the following link to display a rewarded ad
<a href="displayrewardedad://">Display Rewarded Advertisement</a>
- Once a user completes viewing the ad, WebViewGold triggers the JavaScript function
updateRewardedStatus('true');for you to handle rewards within your app’s code.
- To enable rewarded ads, set
- Rewarded Ads as Default:
- If you prefer rewarded ads to display by default, set both
USE_REWARDED_ADS_WHERE_POSSIBLEandSHOW_FULL_SCREEN_ADtotrue. This will prioritize rewarded ads over interstitial ads.
- If you prefer rewarded ads to display by default, set both
Additional Resources:
For more detailed options, refer to the official AdMob SDK documentation, but skip the setup instructions as WebViewGold already includes the necessary framework.
You can also dynamically control the ad visibility for a user by calling the following custom URL schemes from your website or app:
enableads://– Set ads to be shown again for the current userdisableads://– Permanently disables ads for the current user
Step 4: Enable App Open Ads
App open ads are fullscreen ads that appear when the user opens the app (cold start from the launcher splash) or returns to it from the background. To enable them:
- Set
SHOW_APP_OPEN_ADtotruein Config.java. - Replace the
admob_app_open_idvalue in strings.xml with your own AdMob app open ad unit ID (the template ships with the official AdMob test ID — replace it before release!).
Note: App open ads respect the Google consent management setting (ASK_FOR_AD_CONSENT) just like the other AdMob formats.