Found the best answer! (Thank you, sorry for helping me get started!)
ORIENTATION is now deprecated and used for many resources. In addition, it works with reference to magnetic north, which does not give a pure rotation of the device, but in fact always indicates north.
Using ACCELEROMETER, you can calculate the angle of rotation of the device with the values ββ[0] and [1] as follows:
public void onSensorChanged(SensorEvent event) {
Perhaps this may help someone else in the future. Thank you very much!
source share