WebViewGold Documentation · Android
🇺🇸 English
Get WebViewGold

Push Notifications API (OneSignal, Firebase, Pushwoosh)

Send push notifications to your Android app users with OneSignal, Firebase, or Pushwoosh — setup, deep links, and per-user targeting explained.

Push notifications are notifications that appear on your smartphone without opening the app. These types of messages allow fantastic interaction with customers and users of the app. Your app does not have to be open. This way, your customers do not miss any important news or messages. Push Notifications are suitable for many cases, e.g., for updates to orders, live tickers, or social media community. There must be an internet connection to allow app users to receive push messages. WebViewGold supports multiple ways of reaching your users via push notifications.

Option 1: Use Local Push Notification JavaScript API

You can insert a piece of code (JavaScript) in your website, to define a push notification, which can be shown after your app was closed (while scheduling it during the app is open). This works without OneSignal configuration at all.

  <script>
  var title = "Your cart is waiting!"; //notification title
  var message = "You have left a cart full of dreams and deals behind. Dont leave it feeling abandoned"; //notification message
  var seconds = 120; //seconds from now on
  var url = "https://myshop.org/cart.php"; //deep-linking URL

  window.location.href = "sendlocalpushmsg://push.send?s="+ seconds +"=msg!"+ message +"&!#"+ title +"&!#"+ url +"";
  </script>
            

It could be used for different situations (countdowns, happy hours (like in the example code), reminders, ...).
To cancel all scheduled local push notifications run:
<script>
window.location.href = "sendlocalpushmsg://push.send.cancel";
</script>
      



Option 2: Use Pushwoosh Remote Push Notifications

WebViewGold users are eligible for two free months of Pushwoosh!
To claim this offer, please email your WebViewGold License to [email protected] and you will get a personal reply soon.

If you want to use Pushwoosh (good choice!) for push notifications in your app, just activate the options in Config.java by setting PUSHWOOSH_ENABLED to true and ensure to also update the Pushwoosh IDs in the string.xml & AndroidManifest.xml files with your own Pushwoosh IDs:

Send a new push notification to your app users with Pushwoosh
Send a new push notification to your app users with Pushwoosh
Send a new push notification to your app users with Pushwoosh
Congratulations, your setup is already completed. You're now ready to send push notifications:

Send a new push notification to your app users with Pushwoosh

Want to get each individual user's device ID for personalized push notifications or further processing? Simply set WONDERPUSH_ENHANCE_WEBVIEW_URL to true in Config.java to append ?pushwoosh_id=XYZ to your WebView URL:

Send a new push notification to your app users with Pushwoosh

For example, if your WebView URL is https://www.example.org, WebViewGold will call https://www.example.org?pushwoosh_id=XYZ instead. Remember, only the initial URL request will receive this GET variable, so please save it in a session or a cookie for later use within your linked pages. Alternatively or additionally, you can retrieve & process this information on any page using JavaScript:

<script>
window.location.href = "getpushwooshid://";
alert(pushwooshplayerid);
</script>



Option 3: Use OneSignal Remote Push Notifications

If you want to use OneSignal for configuring Remote Push Notifications, this video tutorial will guide you step-by-step during this process.


After completing this video tutorial, you will be able to easily set up remote push notifications for your mobile application using OneSignal. This will allow you to send out important updates, reminders, or promotional content directly to your users' devices, even if they are not currently using your app.


In summary, the process for configuring OneSignal for push notifications is as follows:
  1. Go to the Android Studio and find the OneSignal Options. By default PUSH_ENABLE, PUSH_ENHANCE_WEBVIEW_URL and PUSH_RELOAD_ON_USERID are shown as false, so set them to true.
  2. Open your OneSignal account and select your organization and app name.
  3. If you have not created your app on the OneSignal project follow these steps first.




    Consider that for creating and configuring your OneSignal Account you will need a JSON file. To get this file you must have your Firebase account configured. If you do not have your Firebase configured to get the JSON file, check this additional tutorial.



  4. Once you have created your OneSignal App, go to the settings section and select Native Android as your platform, then copy the App ID code you obtained.
  5. Open the Android Studio and go to the Gradle Scrip Section and select build,grade (Module:app).
  6. On the section ONE_SIGNAL_APP_ID paste the code you had copied from OneSignal.
  7. Then, generate your APK file and run on a physical device.
  8. Go to OneSignal and your app project select New Message and click on New Push.
  9. Fill out the information required and it's done! You have tested your OneSignal Push Messages.


  10. Replace ic_stat_onesignal_default.png to replace the default bell icon fallback of OneSignal push notifications.

    Do you want to get each individual subscription ID on your server for further processing and individual user push messages? Just activate the PUSH_ENHANCE_WEBVIEW_URL option in Config.java (by switching the value from false to true) in order to append ?onesignal_push_id=XYZ to your WebView URL. If your WebView URL is https://www.example.org, WebViewGold will call https://www.example.org?onesignal_push_id=XYZ instead. Only your FIRST URL request will get that GET variable, so save it in a session or in a cookie to access it on your linked pages. An alternative or additional way would be to retrieve & process the information on any page via JavaScript:
    <script>
    window.location.href = "getonesignalplayerid://";
    alert(onesignalplayerid);
    </script>


    Alternatively, consider turning AUTO_INJECT_VARIABLES to true in Config.java to automatically inject this (and other) values into JavaScript without needing to call a URL upfront.




Option 4: Use Firebase Remote Push Notifications

If you want to use Firebase for configuring Remote Push Notifications, this video tutorial will guide you step-by-step during this process.



In summary, the process for configuring Firebase for push notifications is as follows:

    1. Rename package name & create a Firebase project

    Please rename the package name of your WebViewGold Android app. Then, you have to create a Firebase project in your Firebase Console.


    2. Activate Firebase in WebViewGold

    In Android Studio, go to Config.java file and turn the FIREBASE_PUSH_ENABLED variable to true.

    Replace google-services.json in your WebViewGold Android App

    3. Register your app with Firebase

    After you created your Firebase project, you can add your WebViewGold app to it.

    a. In the center of the Firebase console's project overview page, click the Android icon to launch the setup workflow.

    b. If you've already added an app to your Firebase project, click Add app to display the platform options. Enter your app's package name as changed/defined in this step. Make sure that you enter the package name that your app is using. You cannot add or modify this value after you register your app with your Firebase project.

    4. Click the Register app button.

    5. Download google-services.json

    Click Download google-services.json to obtain your Firebase Android config file (google-services.json) and replace the sample file already included in the WebViewGold project by using the Mac Finder or the Windows Explorer:

    Replace google-services.json in your WebViewGold Android App

    That's it!


    If you want to use Firebase URL Deeplinking (opens a specific URL when clicking on your notification), please add the desired URL in a Custom Data field (in the Additional options (optional) section) with Key = "url" and Value = {the desired URL}.

    Add a custom URL for deeplinking purposes in WebView


    Do you want to get each individual subscription ID on your server for further processing and individual user push messages? Just activate the FIREBASE_PUSH_ENHANCE_WEBVIEW_URL option in Config.java (by switching the value from false to true) in order to append ?firebase_push_id=XYZ to your WebView URL. If your WebView URL is https://www.example.org, WebViewGold will call https://www.example.org?firebase_push_id=XYZ instead. Only your FIRST URL request will get that GET variable, so save it in a session or in a cookie to access it on your linked pages. An alternative or additional way would be to retrieve & process the information on any page via JavaScript:

    <script>
    window.location.href = "getfirebaseplayerid://";
    alert(firebaseplayerid);
    </script>


    Alternatively, consider turning AUTO_INJECT_VARIABLES to true in Config.java to automatically inject this (and other) values into JavaScript without needing to call a URL upfront.




Option 5: Use bubble.io Push Notifications

1. Create a bubble.io app
2. Install the WebViewGold OneSignal Push plugin:
bubble.io WebViewGold OneSignal Push plugin
3. Follow the OneSignal instructions (see above) and the plugin instructions (see here and here).

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 →