Push Notifications

Developer Edition
POWERED BY ONESIGNAL

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.

...
arrow_right_circle_fill

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:

...
arrow_right_circle_fill

Then, select “Web Push” as platform:

...
arrow_right_circle_fill

….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)

arrow_right_circle_fill

You can setup a Welcome notification:

...
arrow_right_circle_fill

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:

Path to server worker files :

if your PWA is located in the sub-folder “ myapp ” of the root domain
" https://www.mydomain.com ” then enter /myapp/ in this field.

Main service worker filename :

TB keeps the name of the default service worker, then enter OneSignalSDKWorker.js here. (The name is case sensitive)

Updater service worker filename :

TB keeps the name of the default service worker updater too, then enter OneSignalSDKUpdaterWorker.js here. (The name is case sensitive)

Service worker registration scope :

enter the same value as the "Path to service worker files” . For our exemple /myapp/

...
arrow_right_circle_fill

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:

......
arrow_right_circle_fill

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: ...

......
Copyright©  Nymphide Lab 2020 - All Rights Reserved 

...