On the Android M-Preview GoogleAccountCredential.setSelectedAccount
doesn't seem to work.
When debugging, I noticed that after calling that method, the selectedAccount
and accountName
fields of the object are still null.
While debugging you can see that my variable accountName
is not empty or null, I call the .setSelectedAccountName()
, but as you can see in the debug window, the field in the GoogleAccountCredential is still null.
I think this can be related to some permissions? On my Manifest, I have the following permissions declared:
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
I know that the GET_ACCOUNTS
permission you get for free on M (According to https://developer.android.com/preview/features/runtime-permissions.html#normal ), but the other two permissions are "unknown" to the M-Preview. So maybe, it's that?
android.permission.GET_ACCOUNTS
has protectionLevel:dangerous and is now part of the Contacts permission group, which means you should request it at runtime using the new Activity.requestPermissions()
Only then can you interact with accounts created by other apps on your device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With