Has anyone had any luck with getting geofencing working.
I updated to SDK 32 got Location.startLocationUpdatesAsync working, but no luck with geofencing.
Here’s my code:
Setup task in the TaskManager
TaskManager.defineTask(‘GEO_TRACK_LOCATION’, ({ data: { eventType, region }, error }) => {
if (error) {
console.log(‘GEO_TRACK_LOCATION - ERROR’, { error });
return;
}
if (eventType === Location.GeofencingEventType.Enter) {
console.log(“GEO_TRACK_LOCATION - ENTER”, { eventType, region });
} else if (eventType === Location.GeofencingEventType.Exit) {
console.log(“GEO_TRACK_LOCATION - EXIT”, { eventType, region});
}
});
Registering the task.
Location.startGeofencingAsync(‘GEO_TRACK_LOCATION’, [
{
identifier: ‘1’,
latitude: 34.17,
longitude: -118.40,
radius: 50,
notifyOnEnter: true,
notifyOnExit: true,
}]
);
My infoPlist is
“infoPlist”: {
“UIBackgroundModes”: [“location”],
}
When I try it in the emulator, I immediately get the Exit event and then nothing.
When I try it in TestFlight - nothing, no events are ever fired, no matter where I am located.
Does anyone have a working example?