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

SDK-style implementation notes

Treat this feature as a native capability exposed to your web layer: keep your production website or PWA as the source of truth, then use the documented WebViewGold configuration flags, URL commands, and JavaScript bridge calls to opt in to native Android behavior only where it adds value. This approach keeps your codebase maintainable because the same web application can serve browsers, WebViewGold for Android, and the other WebViewGold platforms with minimal conditional logic.

For reliable results, prefer HTTPS endpoints, stable route names, explicit success/error states in your UI, and small JavaScript helper functions that wrap native calls. For example, a web app built with jQuery Mobile, Lovable, Base44, Bolt, WordPress, Bubble, a custom React/Vue/Angular stack, or static HTML can expose a single button or event handler that triggers the native WebViewGold API while still showing a graceful browser fallback.

  • Recommended integration pattern: detect the app context, call the WebViewGold API, then update your web UI after the native callback or route change.
  • Testing checklist: validate the feature on a real device or packaged build, verify permissions and store review text, and confirm that browser-only users still receive a useful fallback.
  • SEO benefit: keep feature pages, route titles, and structured content indexable on your website while WebViewGold delivers the native app shell for Android users.

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 →