# Modules.CoreMotion.Magnetometer
Allows Titanium client applications to access CoreMotion's Magnetometer APIs.
# Methods
# getMagnetometerData
Returns the latest sample of magnetometer data.
An app that is receiving magnetometer data after calling startMagnetometerUpdates with no callback, needs to periodically check the value returned by this method and process the magnetometer data.
Returns
# isMagnetometerActive
Returns a Boolean indicating whether magnetometer updates are currently happening.
Indicates whether startMagnetometerUpdates has been called since <Modules.CoreMotion.stopMagnetometerUpdates>.
Returns
- Type
- Boolean
# isMagnetometerAvailable
Returns a Boolean indicating whether a magnetometer is available on the device.
Returns
- Type
- Boolean
# setMagnetometerUpdateInterval
The interval in milliseconds, for providing magnetometer updates to the callback.
Parameters
Name | Type | Description |
---|---|---|
interval | Number | The interval in milliseconds |
Returns
- Type
- void
# startMagnetometerUpdates
Starts magnetometer updates.
If a callback is passed to this method, it will be called whenever there is an update. The frequency of these updates can be controlled using the setMagnetometerUpdateInterval method. If no callback is passed, the magnetometer data can be accessed using the getMagnetometerData method. You must call stopMagnetometerUpdates when you no longer want your app to process magnetometer updates.
Parameters
Name | Type | Description |
---|---|---|
callback | Callback<CoreMotionMagnetometerDataWithSuccess> | The method to be called when there is an update. |
Returns
- Type
- void
# stopMagnetometerUpdates
Stops magnetometer updates.
Returns
- Type
- void