Polarsbear Polarsbear - 1 year ago 123
AngularJS Question

Cordova Local notifications plugin not working after a while

I'm working on my 2nd app and having some problems implementing notifications.
It works when app in the foreground, and about 5 min after I put it to the background, even when the app is closed.

So the app listens for a firebase change and then launches;

If the app doesn't respond after a while, I open it and it gives me the notifications

I used cordova.plugins.backgroundMode.enable(); to make the app run in the background, but no luck.

Any ideas or is there a better way to push notifications to your app?

Answer Source

For everybody still searching, You have to capsulate the code in a device.ready(), if not you'll run into this bug

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download