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