# Modules.CoreMotion.Gyroscope
Allows Titanium client applications to access CoreMotion's Gyroscope APIs.
# Methods
# getGyroData
Returns the latest sample of gyroscope data.
An app that is receiving gyroscope data after calling startGyroUpdates with no callback, needs to periodically check the value returned by this method and process the gyroscope data.
Returns
- Type
- CoreMotionGyroData
# isGyroActive
Returns a Boolean indicating whether gyroscope updates are currently happening.
Indicates whether startGyroUpdates has been called since stopGyroUpdates.
Returns
- Type
- Boolean
# isGyroAvailable
Returns a Boolean indicating whether a gyroscope is available on the device.
Returns
- Type
- Boolean
# setGyroUpdateInterval
The interval in milliseconds, for providing gyroscope updates to the callback.
Parameters
Name | Type | Description |
---|---|---|
interval | Number | The interval in milliseconds |
Returns
- Type
- void
# startGyroUpdates
Starts gyroscope 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 <Modules.CoreMotion.setGyroUpdateInterval> method. If no callback is passed, the gyroscope data can be accessed using the getGyroData method. To stop the delivery of events, call the stopGyroUpdates method. Note: It is recommended to set an update interval of at least 250ms before, to avoid receiving too many callbacks at once.
Parameters
Name | Type | Description |
---|---|---|
callback | Callback<CoreMotionGyroDataWithSuccess> | The method to be called when there is an update. |
Returns
- Type
- void