react-native -v): 0.59.8const BGLocationConfig = {
// Geolocation Config
locationAuthorizationRequest: 'Always',
locationAuthorizationAlert: {
titleWhenNotEnabled: 'Location-services not enabled',
titleWhenOff: 'Location-services OFF',
instructions: 'You must set location-services to "Always" for XXXX to work',
cancelButton: 'Cancel',
settingsButton: 'Settings'
},
desiredAccuracy: 0,
distanceFilter: 0,
heartbeatInterval: 60,
// Activity Recognition
stopTimeout: 1,
activityRecognitionInterval: 0,
// Application config
debug: Config.debug,
logLevel: (Config.debug ? BackgroundGeolocation.LOG_LEVEL_VERBOSE : BackgroundGeolocation.LOG_LEVEL_ERROR),
stopOnTerminate: false,
startOnBoot: true,
// HTTP / SQLite config
url: Config.url.post.activity,
httpTimeout: 30000,
geofenceModeHighAccuracy: true,
method: 'POST',
batchSync: false,
autoSync: true,
maxDaysToPersist: 1,
autoSyncThreshold: 0,
httpRootProperty: '.',
geofenceProximityRadius: 20000,
locationTemplate: `{"ts":"<%= timestamp %>","fence_id":0,"action":"EXIT","t":"<%= activity.type %>","c":"<%= activity.confidence %>","speed":<%= speed %>,"latitude":<%= latitude %>,"longitude":<%= longitude %>}`,
geofenceTemplate: `{"ts":"<%= timestamp %>","fence_id":<%= geofence.identifier %>,"action":"<%= geofence.action %>","t":"<%= activity.type %>","c":"<%= activity.confidence %>","speed":<%= speed %>,"latitude":<%= latitude %>,"longitude":<%= longitude %>}`,
headers: { // <-- Optional HTTP headers
'x-api-key': Config.API_KEY,
secret_key: 'user-specific-secret-key?', // TODO: include user secret key
auth_token: 'user-specific-auth-token-goes-here' // TODO: include user auth token
},
params: { // <-- Optional HTTP params
user_id: Config.userId,
device_id: Config.deviceId
}
};
My understanding is that there is a different between geofences loaded in the device and actively monitored with geofenceProximityRadius (https://transistorsoft.github.io/cordova-background-geolocation-lt/interfaces/_cordova_background_geolocation_lt_.geofence.html).
Using getGeofences, can I distinguish between the one loaded in the device and actively monitored? Trying to build a map with loaded vs actively monitored fences like you have on the above link.
Thank you for your help on the other issue. I am using startGeofences now.
No you can鈥檛. However, you can learn about those being actively monitored (and those which become unmonitored) via #onGeofencesChange event.
Let me know if that does what you need. If you need something more specific, I can add a method.
Thank you - I'll try to go with onGeofencesChange and let you know if I need the method.
quick question related to this.
As I understood, onGeofencesChange will let me know the ones inside ("on" array) and outside ("off" array) my geofenceproximityradius but it doesn't tell us the geofences we're actually in (based to the radius we set on each geofence), right?
but it doesn't tell us the geofences we're actually in (based to the radius we set on each geofence), right?
Correct. Listen to #onGeofence to learn when a geofence event occurs.
Well that's a problem. I'm the one who sent you the email about starting the tracking when entered a geofence and as you said I should do back and forth between start and startgeofences, but I can't just do startgeofences on exit since I could have been entered in another geofence, so in this case I should use an external storage to memorize the entered geofences and keep it updated
but I can't just do startgeofences on exit since I could have been entered in another geofence
So?
So would be really cool to have a method that gives back all the geofences we're in or even a property inside a geofence object in the "on" array called something like entered: true/false mainly because working with asyncstorage (or any other storage actually) like that in headless mode can be tricky.
Do you think this can be useful?
I think you should keep track yourself about what geofences you're in.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.
Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.