How to use the expo-sensors.Pedometer.getStepCountAsync function in expo-sensors

To help you get started, we’ve selected a few expo-sensors 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 / PedometerScreen.tsx View on Github external
onPress={async () => {
            const end = new Date();
            const start = new Date();
            start.setDate(end.getDate() - 1);
            const result = await Pedometer.getStepCountAsync(start, end);
            Alert.alert(
              'Pedometer result',
              `Number of steps for the last day: ${result.steps}`
            );
          }}
          title="Get steps count"
github byCedric / use-expo / packages / sensors / src / use-pedometer-history.ts View on Github external
useEffect(() => {
		if (availability) {
			Pedometer.isAvailableAsync().then(setAvailable);
		}

		Pedometer.getStepCountAsync(start, end).then(setData);
	}, []);