try {
await Location.startGeofencingAsync(
TASK_MANAGER_NAMES.GEOFENCE_TASK,
geoZones,
);
} catch (error) {
console.error('Error starting geofencing:', error);
}
after i triggered that function all geofences that located outside my location is triggered by
if (eventType === GeofencingEventType.Enter) {
await scheduleNotificationAsync({
content: {
title: 'Geofence Alert',
body: `You entered the region: ${address[0].name}`,
},
trigger: null,
});
} else if (eventType === GeofencingEventType.Exit) {
await scheduleNotificationAsync({
content: {
title: 'Geofence Alert',
body: `You exited the region: ${address[0].name}`,
},
trigger: null,
});
}
For example, I have seven geofences, and I stay inside one of them. I receive seven push notifications: one about entering the location and six about exiting the location
I expected to recieve notification only when i entered or exited geofences