This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Expo Barometer
A library that provides access to device's barometer sensor.
Barometer from expo-sensors provides access to the device barometer sensor to respond to changes in air pressure, which is measured in hectopascals (hPa).
Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
API
import { Barometer } from 'expo-sensors';
Classes
Type: Class extends DeviceSensor<BarometerMeasurement>
Barometer Methods
Subscribe for updates to the barometer.
EventSubscriptionA subscription that you can call remove() on when you would like to unsubscribe the listener.
Example
const subscription = Barometer.addListener(({ pressure, relativeAltitude }) => { console.log({ pressure, relativeAltitude }); });
Checks user's permissions for accessing sensor.
Promise<PermissionResponse>Returns boolean which signifies if sensor has any listeners registered.
booleanYou should always check the sensor availability before attempting to use it.
Check the availability of the device barometer. Requires at least Android 2.3 (API Level 9) and iOS 8.
Promise<boolean>A promise that resolves to a boolean denoting the availability of the sensor.
Deprecated: use subscription.remove() instead.
voidAsks the user to grant permissions for accessing sensor.
Promise<PermissionResponse>Interfaces
A subscription object that allows to conveniently remove an event listener from the emitter.
Types
Literal type: union
Permission expiration time. Currently, all permissions are granted permanently.
Acceptable values are: 'never' | number