Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request permission on Android M only when targeting lower API

So in my app i would like to add an option to selectively add a permission (say, direct dial) when the user is on Android M but, at the same time, i would like to have that permission NOT showing as required in API 22 or lower simply because its not essential so i prefer not asking for it during install (so de facto making that feature available on M only).

So, i understand the new model of M is that it will allow optional permissions when user is on M and it will make those permissions mandatory when on lower APIs. So is there any known way to just remove those permissions on API lower than 23? Without having separate flavours / APK?

Maybe merging a manifest with just those lines when API is > 22 ? Or there is a cleaner solution?

like image 895
FrankMonza Avatar asked Sep 23 '15 11:09

FrankMonza


1 Answers

This is possible. When reading the documentation there is a special flag to indicate for M only.

Use

<uses-permission-sdk23>

to apply permission for Marshmallow devices only.

like image 82
Thomas R. Avatar answered Oct 20 '22 05:10

Thomas R.