How to determine the angle of orientation of the phone in one plane?
Now I go through the SensorManager:
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mOrientation = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
...
public void onSensorChanged(SensorEvent event) {
xy_angle = event.values[0];
xz_angle = event.values[1];
zy_angle = event.values[2];
Here I get different angles, but I need only one angle, which depends on the rotation of the phone when it goes along the blue line.
How to count or how to get this angle?

How can I use SensorManager.getOrientation to control the tilt, such as "My Paper Plane"? , - the same question here, but I do not understand how the author solves his problem.
source
share