Reputation: 2582
There is the use-permission and use-feature like below:
<uses-permission android:name="android.permission.CAMERA" android:requiredFeature="false"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
I am just not quite clear about the "android:requiredFeature" attribute. Is it the same effect as the "android:required" in use-feature? I just cannot find the android:requiredFeature related infomation in the android developer site and google....
Upvotes: 7
Views: 2125
Reputation: 3155
Yes more or less both have the same effect. android:requiredFeature
is only used in API level 26 and higher if your app has minSdkVersion
less than 26 the application will simply ignore the attribute.
<uses-permission>
generally is used to specify a permission that a user must grant for the app to run correctly, it is not necessarily used to filter the app for devices on Google Play. If you want your app to be filtered for devices based on the hardware feature your app uses, the recommended way is to define <uses-feature>
element in your manifest.
As mentioned in the other answer, based on <uses-permission>
Google play can assume that your app requires the underlying hardware feature and it can filter your app based on that, but its not always true, your app might work without that hardware feature but it prefers to have that feature, So to avoid filtering based on <uses-permission>
, android:requiredFeature
attribute is used to enhance your control over the filtering.
Upvotes: 4
Reputation: 782
I think this is the main cause of the difference, which is not really a difference but a more efficient case of managing what do you want the app store to do with your app.
In some cases, the permissions that you request through can affect how your application is filtered by Google Play.
If you request a hardware-related permission — CAMERA, for example — Google Play assumes that your application requires the underlying hardware feature and filters the application from devices that do not offer it.
To control filtering, always explicitly declare hardware features in elements, rather than relying on Google Play to "discover" the requirements in elements. Then, if you want to disable filtering for a particular feature, you can add a android:required="false" attribute to the declaration.
For a list of permissions that imply hardware features, see the documentation for the element.
from: Android developers
Upvotes: 0