Now this is odd...
Using
AccountManager.newChooseAccountIntent(null, null, new String[] {"com.google"}, null, null, null, null);
does give me a list of accounts. But using
AccountManager.get(context).getAccountsByType("com.google")
returns 0 accounts. The problem only happens in marshmallow.
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
still exists in the manifest.
Any ideas...?
UPDATE: Turns out, must ask permission for GET_ACCOUNTS, even though docs say otherwise... (see comments)
According to this g+ post https://plus.google.com/+BrendonSled/posts/jdrHS3GC7c6 permission GET_ACCOUNTS is now listed as dangerous and user has to allow it
For anyone getting here, the real answer is here
in short, you need to use AccountManager.newChooseAccountIntent()
(ref)
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