cowbell / cordova-plugin-geofence

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

Improve accuracy and response time of geofencing #12

Open bontorhumala opened 9 years ago

bontorhumala commented 9 years ago

Great library man. However, relying in pure android geofencing seems inaccurate for radius less than 1000m (http://stackoverflow.com/questions/23708655/how-to-make-geo-fencing-alert-more-accurate-in-android).

In order to improve the accuracy and response time, I think the plugin can benefit from using hardware GPS reading as suggested on stackoverflow discussion above. I tested by creating other app - which is just an app containing a button to read GPS position. Before I pushed the button on this other app, the notification when I exit a geofence is not displayed. But after I activated the button and got reading, the plugin works and send notification.

tsubik commented 9 years ago

This is an interesting idea but I am worry that will rapidly increase battery drain. The plugin intention is to keep battery drain as lowest as possible, that is why it's using standard API.

timwright35 commented 8 years ago

I have noticed it responds faster if I do a quick get current location poll after the geofences are activate. Maybe it could be a variable that if the developer wants to allow possibly more accurate readings at the cost of battery they could set some options like, allowGPSPolling with another option of GPSPollingInterval (Defaults to 10 minutes or something).

tsubik commented 8 years ago

Yes, I found an article about that http://blog.lemberg.co.uk/fused-location-provider. We could try to do that in that way. I need to think about this a little more. Maybe initialize function should take some options object.

adamalexander commented 5 years ago

Have anybody tried this? and willing to show how this can be done? it seems this repo is inactive :/

adamalexander commented 5 years ago

Since the repo is dead. I'm just going to share what did to overcome this, for anybody who may be faced with this problem.

I used this background geolocation polling plugin. and enabled start on boot and turned off stop on app terminate. The data generated when the GPS is activated in this plugin will be utilized by Google Play Services for the Geofence API in the background. Be conservative, because battery life will be an issue if not handled well.

https://github.com/mauron85/cordova-plugin-background-geolocation