Accelerometer
Accelerometer
An accelerometer is a device that measures the proper acceleration of an object. Proper acceleration is the acceleration (the rate of change of velocity) of the object relative to an observer who is in free fall (that is, relative to an inertial frame of reference).
To get started using it, you must use KmpAccelerometer. To subscribe to changes to the device's orientation, we invoke the startListening function. We can then process the results in our app.
_5KmpAccelerometer.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 acc data changes to our app.
_1KmpAccelerometer.stoplistening()
Any Setup Required?
None