John61590 John61590 - 4 months ago 38
Android Question

Gravity sensor in Android manifest <uses-feature>

This may be a simple question, but I tried to use

<uses-feature android:name="android.hardware.sensor.gravity"
android:required="true" />


in my AndroidManifest.xml file and it seemed to compile, but when I went to Google Play and uploaded my APK, it doesn't seem to recognize it and says "0 supported devices." The documentation doesn't mention android.hardware.sensor.gravity in uses-feature, but you can still use it I guess as it compiles? Is the gravity sensor a part of something else that I don't about? I removed the gravity sensor uses-feature and the Google Play error disappears, so this is the problem.

Answer

The documentation doesn't mention android.hardware.sensor.gravity in uses-feature, but you can still use it I guess as it compiles?

You can put any string in there you want. Only the documented ones will have a useful effect.

Is the gravity sensor a part of something else that I don't about?

Not from the standpoint of <uses-feature>. There is no hardware "gravity" sensor. What you think of as TYPE_GRAVITY is a virtual sensor, as is TYPE_LINEAR_ACCELERATION. Those values are generated based on other sensors, such as the accelerometer.

Comments