[Android] Position Sensors 位置感應器
http://developer.android.com/guide/topics/sensors/sensors_position.html
Orientation Sensor 方向 Sensor
private SensorManager mSensorManager;
private Sensor mSensor;
…
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
@Override
public void onSensorChanged(SensorEvent event) {
float azimuth_angle = event.values[0];
float pitch_angle = event.values[1];
float roll_angle = event.values[2];
// Do something with these orientation angles.
}
azimuth_angle
正北邊為0
往東順時鐘遞增
上限359.999….