Capacitor Plugin - Sensors
Get access to every sensor present in the device!
Supported Android version: 21+
Supported iOS version: Not supported
Supported Browsers: Chromium-based
npm install @danyalwe/capacitor-sensors
npx cap sync
Name
Android
iOS
Web
init
✅
❌
✅
getAvailableSensors
✅
❌
✅
start
✅
❌
✅
stop
✅
❌
✅
addListener
✅
❌
✅
removeAllListeners
✅
❌
✅
requestPermissions
✅
❌
✅
Sensors
Android
iOS
Web
MOTION_DETECTOR
✅
❌
✅
LINEAR_ACCELERATION
✅
❌
✅
MAGNETOMETER
✅
❌
✅
GRAVITY
✅
❌
✅
GYROSCOPE
✅
❌
✅
AMBIENT_LIGHT
✅
❌
✅
ACCELEROMETER
✅
❌
✅
ABSOLUTE_ORIENTATION
✅
❌
✅
RELATIVE_ORIENTATION
✅
❌
✅
TEMPERATURE
✅
❌
❌
GAME_ROTATION_VECTOR
✅
❌
❌
GEOMAGNETIC_ROTATION_VECTOR
✅
❌
❌
HEART_BEAT
✅
❌
❌
HEART_RATE
✅
❌
❌
POSE_6DOF
✅
❌
❌
PRESSURE
✅
❌
❌
PROXIMITY
✅
❌
❌
RELATIVE_HUMIDITY
✅
❌
❌
ROTATION_VECTOR
✅
❌
❌
SIGNIFICANT_MOTION
✅
❌
❌
STATIONARY_DETECTOR
✅
❌
❌
STEP_COUNTER
✅
❌
❌
STEP_DETECTOR
✅
❌
❌
init ( options : SensorOptions ) = > Promise < SensorData | undefined >
Returns: Promise<SensorData >
getAvailableSensors ( ) = > Promise < { sensors : SensorType [ ] ; } >
Returns: Promise<{ sensors: SensorType[]; }>
requestPermissions ( sensor : SensorData ) = > Promise < WebPermissionStatus >
Returns: Promise<WebPermissionStatus >
start ( sensor : SensorData ) = > Promise < void >
stop ( sensor : SensorData ) = > Promise < void >
addListener ( eventName : SensorEvent , listenerFunc : ( event : SensorResult ) = > void ) => Promise < PluginListenerHandle >
Returns: Promise<PluginListenerHandle >
removeAllListeners ( ) = > Promise < void >
Prop
Type
vendor
string
version
number
type
number
maxRange
number
resolution
number
power
number
minDelay
number
maxDelay
number
Prop
Type
remove
() => Promise<void>
Prop
Type
accuracy
number
timestamp
number
values
number[]
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'
keyof typeof SensorType
Members
AMBIENT_LIGHT
ACCELEROMETER
TEMPERATURE
GAME_ROTATION_VECTOR
GEOMAGNETIC_ROTATION_VECTOR
GRAVITY
GYROSCOPE
HEART_BEAT
HEART_RATE
LINEAR_ACCELERATION
MAGNETOMETER
MOTION_DETECTOR
POSE_6DOF
PRESSURE
PROXIMITY
RELATIVE_HUMIDITY
ROTATION_VECTOR
SIGNIFICANT_MOTION
STATIONARY_DETECTOR
STEP_COUNTER
STEP_DETECTOR
ABSOLUTE_ORIENTATION
RELATIVE_ORIENTATION
Members
FASTEST
GAME
UI
NORMAL