Guides
Plan-enterprise-icon
Expo Application Services
API Reference

Sensors


expo-sensors provides various APIs for accessing device sensors to measure motion, orientation, pressure, magnetic fields, and step count.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb
Status-success-iconStatus-success-iconStatus-success-iconStatus-success-iconStatus-success-icon

Installation

Terminal
expo install expo-sensors

If you're installing this in a bare React Native app, you should also follow these additional installation instructions.

API

import * as Sensors from 'expo-sensors';
// OR
import {
  Accelerometer,
  Barometer,
  Gyroscope,
  Magnetometer,
  MagnetometerUncalibrated,
  Pedometer,
} from 'expo-sensors';

For more information, please see the documentation for the sensor you are interested in:

  • Accelerometer
  • Barometer
  • Gyroscope
  • Magnetometer
  • Pedometer
  • Message-iconAsk a question on the forums about Sensors
  • Github-iconView open bug reports for Sensors
  • Code-iconView source code for Sensors
  • Build-iconView package in npm Registry
  • Edit-iconEdit this page

Was this doc helpful?