The Push Notifications Plugin lets you add Push Notifications to your App (Android only, iOS doesn’t supports yet this feature for PWA)
oneSignal Plugin is only available for PWA (WebApp) projects.
In order to enable this Plugin, you have first to create an account at oneSignal
https://app.onesignal.com/Important: if you want the Push Notifications to work correctly, your PWA must be served over https.
Then, from the oneSignal Dashboard, you can create a new App:
Then, select “Web Push” as platform:
….And “Typical Site” as Integration:
You must enter the URL of your PWA, as described, if your PWA is located within a subfolder (eg. https://wwwmydomain.com/mypwa ), don’t enter here the subfolder, but just the root url (https://wwwmydomain.com)
You can setup a Welcome notification:
Service Worker Setup
oneSignal implements a Service Worker in order to work even if the App is not launched on the user’s mobile.
If your PWA is hosted inside a subfolder of the root domain, then you must activate the option “Customize Service Worker” and enter the following values:
if your PWA is located in the sub-folder “ myapp ” of the root domain
" https://www.mydomain.com ” then enter /myapp/ in this field.
TB keeps the name of the default service worker, then enter OneSignalSDKWorker.js here. (The name is case sensitive)
TB keeps the name of the default service worker updater too, then enter OneSignalSDKUpdaterWorker.js here. (The name is case sensitive)
enter the same value as the "Path to service worker files” . For our exemple /myapp/
Get ONESIGNAL APP ID and REST API KEY
Once you have created your oneSignal App, you can get the 2 keys from the oneSignal Dashboard=>Settings=>Keys&ID
Enter the 2 keys in the Push Notification Plugin settings in Thorium:
Sending Messages
Now you can send messages to registered users, from the oneSignal Dashboard, or by using the embedded Push Notification Dialog implemented in TB: ...
...