Skip to main content

Gyroscope

Gyroscope

A gyroscope is a device used for measuring or maintaining orientation and angular velocity.

To get started using it, you must use KmpGyroscope. To subscribe to changes to the device's gyroscope data, we invoke the startListening function. We can then process the results in our app.


_5
KmpGyroscope.startListening {
_5
val x = it.first
_5
val y = it.second
_5
val z = it.third
_5
}

To stop listening to acc changes, we use the function stopListening. It's important to deactivate the listener, so the component doesn't continue to broadcast gyroscope data changes to our app.


_1
KmpGyroscope.stoplistening()

Any Setup Required?

None