You can use Kotlin coroutines to get rid of the callback. It of course is a suspend function so it must be called within a coroutine scope.
Code sample below demonstrates how to observe Gyroscope sensor. Please note that we are filtering events occurring when sensor readings change with ReactiveSensorEvent::sensorChanged method. There's ...