Skip to main content
Use this API to start the compass sensor. After calling this, you can use my.onCompassChange to receive compass heading data.

Parameters

Code Example

Basic Usage

Combining with Location

The compass may not be available on all devices. Always handle the fail callback to provide a fallback experience.

my.onCompassChange

Listen for compass data

my.offCompassChange

Stop listening