Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
TaskManager.defineTask(GEOFENCING_TASK, async ({ data: { region } }: { data: any }) => {
const stateString = Location.GeofencingRegionState[region.state].toLowerCase();
// tslint:disable-next-line no-console
console.log(`${stateString} region ${region.identifier}`);
await Notifications.presentLocalNotificationAsync({
title: 'Expo Geofencing',
body: `You're ${stateString} a region ${region.identifier}`,
data: region,
});
});
TaskManager.defineTask(GEOFENCING_TASK, async ({ data: { region } }) => {
const stateString = Location.GeofencingRegionState[region.state].toLowerCase();
const body = `You're ${stateString} a region with latitude: ${region.latitude}, longitude: ${region.longitude} and radius: ${region.radius}m`;
await Notifications.presentLocalNotificationAsync({
title: 'Expo Geofencing',
body,
data: {
...region,
notificationBody: body,
notificationType: GEOFENCING_TASK,
},
});
});
}