App not available for Nexus 7 on Google Play

2020-02-05 03:44发布

问题:

I am aware of the camera availability on Nexus 7 so I changed my manifest making the permission not required as follow:

<uses-permission android:name="android.permission.CAMERA" android:required="false"/>

The app is still not available. At this point I am confused from the doc which talks about uses-feature rather than user-permission:

Be aware of which system features that you declare (or imply) are required to run your application or the Play Store will not make your application available to Nexus 7 users. Always declare hardware features that aren't critical to your app as required="false" then detect at runtime if the feature is present and progressively enhance functionality

What's the deal here? I am confused about the difference between features and permissions.

回答1:

uses-feature declares what types of hardware/software availability your app uses. You can use this to automatically narrow down what types of devices it will appear to. You can declare any of these features as optional, if the app is able to still function without them, and is designed to handle situations in which the feature is unavailable (such as with the Nexus 7 as you mentioned).

uses-permission declares what types of functions your app is allowed to use. If you declare the permission, as you've done, it lets the user know "Hey, this app is allowed to use my camera" and they can decide whether or not to approve that usage. You cannot mark a permission as optional.

You should instead leave the required attribute off of the uses-permission tag, and add another tag for the camera with uses-feature, and in that tag, mark it as required="false". For example:

<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>

EDIT: Reading this document, it appears you may also have to add:

<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>

since the camera permission implies the requirement of these two features. It may work without this extra tag, but it probably wouldn't hurt to be over-specific, just in case.