radarlabs / cordova-plugin-radar

Cordova plugin for Radar, the leading geofencing and location tracking platform
https://radar.io
Apache License 2.0
15 stars 11 forks source link

OnEvents() not working in background #2

Open Warface opened 4 years ago

Warface commented 4 years ago

Me again!

Seems that the OnEvents() is not fired in background when app is killed. It still track my position but the ajax call sending a push notification isn't working.

It works if app is "minimized" but the Worker doesn't seem to listen to the OnEvents() function so the push is not send.

nickpatrick commented 4 years ago

@Warface When the app is killed, subsequent location updates will wake it up again. Make sure your JavaScript bundle is being parsed and your event listeners are being added even when the app is backgrounded. You may need to add the event listeners outside of your UI lifecycle.

Warface commented 4 years ago

The location is updated true but the event listener isn't firing if app is killed. I only have the location update, I need to fire the OnEvents() method too so I can send the push. Try it for yourself, you'll see that the OnEvents() does nothing when app is killed.

I've made a simple ajax call that post to FCM for sending push notifications which is working in foreground and app mininize(not killed). The push is working but when app is killed, nothing is sent.

My guess is the Worker working in background only works to update the location but not firing the listeners.

Warface commented 4 years ago

Any news on this topic. I saw that a new push has been made