Android 6.0 permission.GET_ACCOUNTS

后端 未结 6 989
予麋鹿
予麋鹿 2020-12-24 11:47

I\'m using this to get permission:

if (ContextCompat.checkSelfPermission(context, Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {

         


        
6条回答
  •  暖寄归人
    2020-12-24 12:29

    That is because of Permission Groups. Basically, permissions are placed under different groups and all permissions from that group would be granted if one of them is granted.

    Eg. Under "Contacts" , there is write/read contacts and get accounts, so when you ask for any of those, the popup asks for Contacts permissions.

    Read through: Everything every Android Developer must know about new Android's Runtime Permission


    EDIT 1

    Just thought i'l add the related(not to get accounts but permissions and groups) Oreo update info:
    source: https://developer.android.com/about/versions/oreo/android-8.0-changes.html#rmp

    Prior to Android 8.0 (API level 26), if an app requested a permission at runtime and the permission was granted, the system also incorrectly granted the app the rest of the permissions that belonged to the same permission group, and that were registered in the manifest.

    For apps targeting Android 8.0, this behavior has been corrected. The app is granted only the permissions it has explicitly requested. However, once the user grants a permission to the app, all subsequent requests for permissions in that permission group are automatically granted.


提交回复
热议问题