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