cowbell / cordova-plugin-geofence

Geofencing plugin for cordova
Apache License 2.0
264 stars 318 forks source link

OnTransitionReceived() not working in IOS? #193

Open nielsbekkers opened 7 years ago

nielsbekkers commented 7 years ago

Geofence.onTransitionReceived() is not responding something when I enters/exits my zone. I've put this function in my Providers/geofence-service.ts file, Can someone tell me how to use the OnTransitionReceived() function in IOS? For this project I use IONIC2. I want to use this to execute my own function when I enters/exits my zone, now only an alert is shown.

screenshot at nov 28 09-29-47
zefrench commented 7 years ago

Hi, Did you found how to make it works ?

nielsbekkers commented 7 years ago

Hi, I use the Haversine Formula to calculate my distance (between 2 points) that is constantly monitoring. Now I can execute any function when I get close enough to my company.

Wade-BuildOtto commented 7 years ago

Here is my take on the issue, and possible fix. Alternatively even if the app restarts the transition should still be able to be picked up and processed.

geolocation

Wade-BuildOtto commented 7 years ago

Apple won't let you deploy an app that is constantly looking for location, that would be a drain on resources.

Wade-BuildOtto commented 7 years ago

The issue is when the app is minimized, IOS in an attempt to reduce load kills the Webview, once the app is opened again it takes a moment with the correct plugin to recover but by that time, the code fails to execute the transition.

a possible solution is to add parameters in the URL as a query string so that once the app does recover it can just grab the parameters and execute the trigger event.

This should resolve the issue. without to much of a major change even just an add-on function.

brijesh-p commented 6 years ago

@Wade-BuildOtto , having same issue with ionic 2 geofence plugin, can you suggest what exactly has to do here "URL as a query string".

Wade-BuildOtto commented 6 years ago

instead of waiting for the app to wake up, execute the code to make a method call to bypass it and have the Swift code to directly make an API call to your server.

This way it doesn't matter if the code comes back or not it makes the call directly.