A library that provides access to a device's accelerometer, barometer, motion, gyroscope, magnetometer, and pedometer.
expo-sensors provides various APIs for accessing device sensors to measure motion, orientation, pressure, magnetic fields, ambient light, and step count.
npx expo install expo-sensors
import * as Sensors from 'expo-sensors';
} from 'expo-sensors';
Starting in Android 12 (API level 31), the system has a 200ms limit for each sensor updates.
If you need an update interval of less than 200ms, you must add the following permissions to your app.json inside the
Allows an app to access sensor data with a sampling rate greater than 200 Hz.
Learn how to configure the native projects in the installation instructions in the
For more information, please see the documentation for the sensor you are interested in:
Measures device acceleration on all platforms.
Measures pressure on Android and iOS platforms.
Measures device motion on all platforms.
Measures device rotation on all platforms.
Measures magnetic fields on Android and iOS platforms.
Measures ambient light on Android platform.
Measures steps count on Android and iOS platforms.