WebViewGold Documentation · Android
🇺🇸 English
Get WebViewGold

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_AD to true for banner ads and SHOW_FULL_SCREEN_AD to true for interstitial ads.
  • Define intervals for displaying interstitial ads by changing SHOW_AD_AFTER_X to 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:

Enable specific AdMob ad blocs in your app

Step 3: Enable Rewarded Ads

  • Setting Up Rewarded Ads:
    • To enable rewarded ads, set ENABLE_REWARDED_ADS to true.
    • 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.
  • Rewarded Ads as Default:
    • If you prefer rewarded ads to display by default, set both USE_REWARDED_ADS_WHERE_POSSIBLE and SHOW_FULL_SCREEN_AD to true. This will prioritize rewarded ads over interstitial ads.

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 user
  • disableads:// – 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_AD to true in Config.java.
  • Replace the admob_app_open_id value 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.

Too busy? We set up your app for you.

Our team configures, builds & submits your WebViewGold app — done-for-you, fast turnaround, Made in Germany.

Get your app set up →

Build in your browser

No Mac, no IDE: the WebViewGold Cloud Builder configures, builds & uploads your app online.

Discover Cloud Builder →