I am facing several weird outcomes:
1.I defined 2 background tasks with TaskManager.defineTask (TaskManager - Expo Documentation) - TaskA and TaskB. Then I registered geofences with locationStartGeofencingAsync for Loc1 with TaskA and another for Loc2 with TaskB. (i.e. locationStartGeofencingAsync(TaskA,Loc1) and locationStartGeofencingAsync(TaskB,Loc2) ).
Expected Outcome:
geofence trigger for Loc1 => TaskA,
geofence trigger for Loc2 => TaskB
Actual outcome:
geofence trigger for Loc1 => Task A & Task B
geofence trigger for Loc2 => Task A & Task B
I can work around it, BUT my question is: isn’t it possible to define different geofence task for different geofence?
another unexpected outcome is that on IOS I receive exit notification even when notifyOnExit is set to false. Same for entry on IOS when notifyOnEnter is set to false. (works perfectly on Anrdoid).
I can work around it as well, BUT it is missing the point of notifyOnEnter and notifyOnExit.
Is this the expected behaviour on IOS?
@charliecruzan I believe you are the Expo expert for this topic. Appreciate your thoughts on the above. Thanks!
for the sake of simplicity this is how I register the tasks:
export const GEOFENCING_TASK_A = “geofencing-task-A”;
export const GEOFENCING_TASK_B = “geofencing-task-B”;
and executing defineGeofencingTasks()
in App.js before export default function App() {…}.
The geofences are then registered by running
Location.startGeofencingAsync(GEOFENCING_TASK_A, geofenceArray_A)
Location.startGeofencingAsync(GEOFENCING_TASK_B, geofenceArray_B)
the outcome is that for every geofence event (entry or exit for geofenceArray_A) GEOFENCING_TASK_A and GEOFENCING_TASK_B are both executed.
(for example for entry event in geofenceArray_A the console will log
“enter - Task A”
“enter - Task B”
).