gurudey / Titanium-Appcelerator-GeoFence-Module-iOS

Titanium Appcelerator GeoFence Module for iOS Only
Other
6 stars 4 forks source link

Repeating regions #2

Open jasonkneen opened 5 years ago

jasonkneen commented 5 years ago

Hi,

Trying to use this to basically monitor a region (point) then when the user exits create a new monitoring region based on their location.

I'm using the same id / title to refresh the existing region and get some odd issues -- multiple instances of "monitoring regions" and incorrect lon/lat being shown

Is there a good way to handle this scenario?

gurudey commented 5 years ago

You should stop geofencing before you try to update regions.

var geofencing = require('ci.geofencing');
regions.push({
    "title" : "Chicago Theater",
    "latitude" : 41.88535,
    "longitude" : -87.62745,
    "radius" : 200
});
geofencing.stopGeoFencing();
geofencing.startGeoFencing(regions, function(e){
    regions = [];
});
jasonkneen commented 5 years ago

Tried that -- doesn't work. Between launches I was finding old geofences were being recognised and retained despite me stopping -- so it was unreliable as a method of chaining updates.

Sorry!