# Modules.CoreMotion.Gyroscope

Allows Titanium client applications to access CoreMotion's Gyroscope APIs.

Availability
5.2.0

# Methods

# getGyroData

Availability
5.2.0
getGyroData() CoreMotionGyroData

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


# isGyroActive

Availability
5.2.0
isGyroActive() Boolean

Returns a Boolean indicating whether gyroscope updates are currently happening.

Indicates whether startGyroUpdates has been called since stopGyroUpdates.

Returns

Type
Boolean

# isGyroAvailable

Availability
5.2.0
isGyroAvailable() Boolean

Returns a Boolean indicating whether a gyroscope is available on the device.

Returns

Type
Boolean

# setGyroUpdateInterval

Availability
5.2.0
setGyroUpdateInterval(interval) void

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

Availability
5.2.0
startGyroUpdates([callback]) void

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

# stopGyroUpdates

Availability
5.2.0
stopGyroUpdates() void

Stops gyroscope updates.

Returns

Type
void