Skip to content

@capgo/capacitor-accelerometer

Capacitor plugin contract for working with the device accelerometer.

@capgo/capacitor-accelerometer exposes device acceleration for games, fitness form checks, and gesture experiments. Stream measurement events on iOS, Android, and supported mobile browsers.

PlatformSupport
iOSCore Motion
AndroidSensorManager
WebDevice motion events when permitted
  • getMeasurement - Get the most recent accelerometer sample that was recorded by the native layer.
  • isAvailable - Check if the current device includes an accelerometer sensor.
  • startMeasurementUpdates - Begin streaming accelerometer updates to the JavaScript layer.
  • stopMeasurementUpdates - Stop streaming accelerometer updates started via startMeasurementUpdates.
MethodDescription
getMeasurementGet the most recent accelerometer sample that was recorded by the native layer.
isAvailableCheck if the current device includes an accelerometer sensor.
startMeasurementUpdatesBegin streaming accelerometer updates to the JavaScript layer.
stopMeasurementUpdatesStop streaming accelerometer updates started via startMeasurementUpdates.
checkPermissionsReturn the current permission state for accessing motion data.
requestPermissionsRequest permission to access motion data if supported by the platform.
addListenerListen for measurement updates.
removeAllListenersRemove all listeners that have been registered on the plugin.
getPluginVersionGet the native Capacitor plugin version.

This reference is synced from src/definitions.ts in capacitor-accelerometer.

Keep going from @capgo/capacitor-accelerometer

Section titled “Keep going from @capgo/capacitor-accelerometer”

If you are using @capgo/capacitor-accelerometer to plan dashboard and API operations, connect it with Using @capgo/capacitor-accelerometer for the native capability in Using @capgo/capacitor-accelerometer, API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, API Keys for the implementation detail in API Keys, and Devices for the implementation detail in Devices.