File: sensors.md | Updated: 11/15/2025
Hide navigation
Search
Ctrl K
Home Guides EAS Reference Learn
Reference version
SDK 52
Archive Expo Snack Discord and Forums Newsletter
Expo SensorsA library that provides access to a device's accelerometer, barometer, motion, gyroscope, light, magnetometer, and pedometer.
Android
iOS
Web
Bundled version:
~14.0.2
Copy page
expo-sensors provide various APIs for accessing device sensors to measure motion, orientation, pressure, magnetic fields, ambient light, and step count.
Terminal
Copy
- npx expo install expo-sensors
If you are installing this in an existing React Native app
, make sure to install expo
in your project.
You can configure expo-sensors using its built-in config plugin
if you use config plugins in your project (Continuous Native Generation (CNG)
). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does not use CNG, then you'll need to manually configure the library.
app.json
Copy
{ "expo": { "plugins": [ [ "expo-sensors", { "motionPermission": "Allow $(PRODUCT_NAME) to access your device motion" } ] ] } }
| Name | Default | Description |
| --- | --- | --- |
| motionPermission | "Allow $(PRODUCT_NAME) to access your device motion" | Only for: <br><br>iOS<br><br> <br><br>A string to set the NSMotionUsageDescription<br> permission message or false to disable motion permissions. |
Are you using this library in an existing React Native app?
If you're not using Continuous Native Generation (CNG
) or you're using native android project manually, add HIGH_SAMPLING_RATE_SENSORS permission to your project's android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
import * as Sensors from 'expo-sensors'; // OR import { Accelerometer, Barometer, DeviceMotion, Gyroscope, LightSensor, Magnetometer, MagnetometerUncalibrated, Pedometer, } from 'expo-sensors';
Starting in Android 12 (API level 31), the system has a 200Hz limit for each sensor updates.
If you need an update interval of greater than 200Hz, you must add the following permissions to your app.json inside the expo.android.permissions
array.
| Android Permission | Description |
| --- | --- |
| HIGH_SAMPLING_RATE_SENSORS | Allows an app to access sensor data with a sampling rate greater than 200 Hz. |
The following usage description keys are used by this library:
| Info.plist Key | Description |
| --- | --- |
| NSMotionUsageDescription | A message that tells the user why the app is requesting access to the device’s motion data. |
For more information, see the documentation for the sensor you are interested in:
Accelerometer
Measures device acceleration on all platforms.
Barometer
Measures pressure on Android and iOS platforms.
DeviceMotion
Measures device motion on all platforms.
Gyroscope
Measures device rotation on all platforms.
Magnetometer
Measures magnetic fields on Android and iOS platforms.
LightSensor
Measures ambient light on Android platform.
Pedometer
Measures steps count on Android and iOS platforms.