Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android:what's the differences between the "required" in use-feature and the "requiredFeature" in user-permission?

Tags:

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....

like image 422
mianlaoshu Avatar asked Mar 14 '18 10:03

mianlaoshu


People also ask

What is user permission in android?

Specifies a system permission that the user must grant in order for the app to operate correctly. Permissions are granted by the user when the application is installed (on devices running Android 5.1 and lower) or while the app is running (on devices running Android 6.0 and higher).

Which element is used to define permissions Android?

Using "permission" element in android manifest file, we can define a permission. This permission can be added to permission-group. if we name this permission-group as "com.


1 Answers

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.

like image 161
Sam Avatar answered Oct 13 '22 18:10

Sam