I'm developing an app which uses rotation vector to determine angle of the device relative to the ground. To get that angle I use one of rotation vectors.
TYPE_ROTATION_VECTOR
- for devices which have gyroscope and magnetometer.
TYPE_GAME_ROTATION_VECTOR
- for devices which have only a gyroscope.
TYPE_GEOMAGNETIC_ROTATION_VECTOR
- for devices which have only a magnetometer.
So, I created three flavors, each has appropriate code to get that software sensor, and each has appropriate feature required in manifest.
After uploading multiple APKs to Google Play devices were able to get correct APK, basing on what sensor they have.
But, there is a case when device (for example, old Samsung Galaxy A5) has a magnetometer (so, it can download the third build), but it doesn't have software sensor, and getDefaultSensor(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR)
returns null
.
The question is - how to make a filter not only for a hardware sensor like this:
<uses-feature
android:name="android.hardware.sensor.compass"
android:required="true"/>
but also to filter by software sensor. Is this even possible? Or is there any other way to hide the app from GP for devices without such sensors?
I don't believe this is possible using the manifest right now. I suspect you don't have too many problematic devices, as these will be pretty rare. You could always exclude these models individually in the Device Library in the Play console.