cowbell / cordova-plugin-geofence

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

iOS 20+ geofences #15

Open wallstudios opened 9 years ago

wallstudios commented 9 years ago

@tsubik technical question.

When I am adding bulk geofences they all get added to the database but in iOS only the first 20 are monitored. 20 is the iOS limit.

Question is , is there a way of changing which ones are monitored without having to remove them all and only add in 20?

Say I have 40 locations added to the database but I only want to monitor the closest 20.

tsubik commented 9 years ago

Yes I know about that limitation. Don't have time to create some solution yet. Maybe the good one will be use some kind of "refresh" area. If user leaves area with given radius plugin will find the closest 19 geofences from the current position and also will start monitoring new "refresh" area.

wallstudios commented 9 years ago

@tsubik I've started to implement basically that. when the app loads it is getting the users location and adding in the locations (geofences) within a certain distance. I'll expand on it some more but wasn't sure if I could simply change a flag or something in the database where you are keeping the geofences to get them monitored instead of the default first 20. Currently I'm removing all geofences then adding in the new ones. I like your idea of using receiveTransition. I'll give that a go. Obviously I wont be able to change these from the background though.

        window.geofence.receiveTransition = function (geofences) {
            geofences.forEach(function (geo) {
            //find closest locations and add geofences....
            });
        };