Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I only require a permission in certain versions of Android?

GCM does not require android.permission.GET_ACCOUNTS on JellyBean and above. My app, however, works with API level 11 and greater, so I need to declare it on those devices.

As I have no need for using accounts other than GCM, can I only register this permission on versions of android below API level 16? My app is quite security-conscious, so avoiding this permission would be a huge plus.

like image 700
Charles Munger Avatar asked Dec 10 '12 14:12

Charles Munger


2 Answers

There is not a value of the tag that does this. However, you could release two builds, one for 11-13 API and the other for 14+

But honestly, I wouldn't bother with the 11-13 range. As the android stats indicates, only ~1.6% of users are using one of those builds. Limited to those just over 11, that's only a 4.4% loss of potential users, which will only probably go down with time.

like image 149
PearsonArtPhoto Avatar answered Sep 29 '22 10:09

PearsonArtPhoto


With the addition of SDK 23 (Marshmallow), you can make use of the new permissions declaration below to indicate that the application only requires permissions on API 23 or above devices.

<uses-permission-sdk23>

Source: http://developer.android.com/guide/topics/manifest/uses-permission-sdk23-element.html

like image 27
TheIT Avatar answered Sep 29 '22 11:09

TheIT