weston
weston

Reputation: 54781

What does android:required="false" mean WRT to uses-permission?

I'm integrating an SDK and it requires I put this:

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

I understand android:required="false" on a uses-feature, but I can't understand the meaning on a permission. It's not listed in the docs as a attribute.

Is it similar to requires on a uses-feature? Where permissions imply features as listed here, then those features are not required?

Upvotes: 6

Views: 5542

Answers (3)

Joe Malin
Joe Malin

Reputation: 8641

uses-permission does not use the attribute android:required, but uses-feature does. The ideas are similar, but not identical, which is why it's easy to mix up their attribute requirements.

Upvotes: 3

ssantos
ssantos

Reputation: 16526

uses-permission just tells the users that the app will use some feature but it's not mandatory that the device includes it in order to properly work.

android-required means that the feature is mandatory, and the app won't be visible for devices that don't implement it.

For instance.-

implies that the application uses camera features. If the camera is a must feature for your app, setting android:required="true" will prevent it from being downloaded to devices that have no camera.

EDIT

Actually, I was thinking in uses-feature tags. uses-permission has no required attribute.

Upvotes: 5

Geobits
Geobits

Reputation: 22342

As you say, according to the documentation, it isn't a valid attribute in a <uses-permission> tag. It goes on to say (emphasis mine):

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.

I would suggest your SDK documentation might be wrong, and you should include a <uses-feature> tag for any implied features.

Upvotes: 6

Related Questions