Skip to main content
Back to plugins
@capgo/capacitor-barometer
Tutorial
by github.com/Cap-go

Barometer

Access device barometer for atmospheric pressure and altitude readings

Guide

Tutorial on Barometer

Using @capgo/capacitor-barometer

Capacitor plugin contract for working with the device barometer sensor.

Install

bun add @capgo/capacitor-barometer
bunx cap sync

What This Plugin Exposes

  • getMeasurement - Get the most recent barometer reading captured by the native layer.
  • isAvailable - Check if the current device includes a barometer sensor.
  • startMeasurementUpdates - Begin streaming barometer updates to the JavaScript layer.
  • stopMeasurementUpdates - Stop the continuous updates started via .

Example Usage

getMeasurement

Get the most recent barometer reading captured by the native layer.

import { CapacitorBarometer } from '@capgo/capacitor-barometer';

await CapacitorBarometer.getMeasurement();

isAvailable

Check if the current device includes a barometer sensor.

import { CapacitorBarometer } from '@capgo/capacitor-barometer';

await CapacitorBarometer.isAvailable();

startMeasurementUpdates

Begin streaming barometer updates to the JavaScript layer.

import { CapacitorBarometer } from '@capgo/capacitor-barometer';

await CapacitorBarometer.startMeasurementUpdates();

stopMeasurementUpdates

Stop the continuous updates started via .

import { CapacitorBarometer } from '@capgo/capacitor-barometer';

await CapacitorBarometer.stopMeasurementUpdates();

Full Reference