Request permission on Android M only when setting up a lower API

So, in my application, I would like to add an option to selectively add permission (for example, direct dialing) when the user is on Android M, but at the same time I would like this permission to NOT be shown as needed in API 22 or lower simply because it is not essential, so I prefer not to request it during installation (so that de facto makes this function available only on M).

So, I understand that the new M model is that it will allow additional permissions when the user is on M, and this will make these permissions mandatory when at lower APIs. So, is there any known way to just remove these permissions for APIs below 23? Without separate flavors / APK?

Maybe merging a manifest with such strings when API> 22? Or is there a cleaner solution?

+6
source share
1 answer

It is possible. When reading the documentation there is a special flag indicating only M.

Using

<uses-permission-sdk23> 

apply permissions only to Marshmallow devices.

+8
source

All Articles