How to use the expo-location.GeofencingRegionState function in expo-location

To help you get started, we’ve selected a few expo-location examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo / apps / native-component-list / src / screens / Location / GeofencingScreen.tsx View on Github external
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,
  });
});
github expo / expo / home / screens / GeofencingScreen.js View on Github external
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,
      },
    });
  });
}