Reputation: 8080
Am trying to update my app with the new Android M permissions which uses Google+ login, but when I do a checkSelfPermission(Manifest.permission.GET_ACCOUNTS)
the dialog that pops up says "Allow MyApp to access your contacts?" with the Deny and Allow buttons.
This seems kind of weird for the GET_ACCOUNTS permission. Shouldn't it say something related to access your accounts instead? Is this a bug? Or should I be doing something differently?
Upvotes: 12
Views: 4133
Reputation: 219
I was updating a client's app this afternoon which allows users to login with Google+. You might not need to check the GET_ACCOUNTS permission at runtime. I updated the manifest to qualify the GET_ACCOUNTS permission with android:maxSdkVersion="22"
.
On a Nexus 5 running Marshmallow I was able to successfully login using Google+ without displaying a runtime permissions dialog. Nor does Contacts appear in Settings>Apps>[my client's app]>Permissions.
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" android:maxSdkVersion="22"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" android:maxSdkVersion="22"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" android:maxSdkVersion="22"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS" android:maxSdkVersion="22"/>
Documentation for GET_ACCOUNTS reflecting change of behaviour in Marshmallow is described here.
Upvotes: -1
Reputation: 7329
I would recommend moving away from Google+ login and using the new Google login. It requires no special permissions to access email and can be easily integrated.
https://developers.google.com/identity/sign-in/android/start
Upvotes: 4
Reputation: 1984
The GET_ACCOUNTS permission is part of the android.permission-group.CONTACTS group, along with the
This is why you get the message for CONTACTS.
So when you ask for one permission in a group, you will get all of them in that group. You can find more information about permission in Android M here
Upvotes: 5