Local notifications

I have an app that needs to display local notifications (not push notifications) to the user.
I have a piece of code that successfully does that via navigator.serviceWorker.

It works in a browser but not in my PhoneGap compiled applications, neither for iOS nor for Android.
These lines will return the error described in the string:

if (!('Notification' in window) || !('ServiceWorkerRegistration' in window)) {
            DebugError("Browser does not support notifications.");

Could you point me in the right direction?

Thanks a lot.

You’ll need to use a plug in. There are a number of these available on npmjs.com.

Here’s one:

I have no idea how well it works or whether there are better alternatives - perhaps someone else can answer.

1 Like