Which feature do I have to use in order to enable my app only for devices which include Orientation Sensor?

StackOverflow https://stackoverflow.com/questions/17911013

문제

My app uses "Orientation Sensor", as you can see here:

SensorManager sensorMgr = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
Sensor sensor = sensorMgr.getDefaultSensor(Sensor.TYPE_ORIENTATION);

I want to define < uses-feature> in my Manifest file in order to enable my app only for devices which can actually use this sensor, a.k.a. devices which have "Orientation Sensor".

The problem is that the available features does not include Orientation Sensor. The included sensors are:

  • Accelerometer
  • Barometer
  • Compass
  • Gyroscope
  • Light
  • Proximity

(As mentioned here: http://developer.android.com/guide/topics/manifest/uses-feature-element.html#hw-features)

Which sensor should I choose? Is it accelerometer, compass or gyroscope?

도움이 되었습니까?

해결책

According to android documentation "The orientation sensor derives its data by using a device's geomagnetic field sensor in combination with a device's accelerometer." Refer to this page for more information HERE . It further says "The orientation sensor derives its data by processing the raw sensor data from the accelerometer and the geomagnetic field sensor. Because of the heavy processing that is involved, the accuracy and precision of the orientation sensor is diminished (specifically, this sensor is only reliable when the roll component is 0). As a result, the orientation sensor was deprecated in Android 2.2 (API level 8)"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top