getAccountsByType不会返回marshmallow中的任何内容

rot*_*d86 10 android android-6.0-marshmallow

现在这很奇怪......

运用

AccountManager.newChooseAccountIntent(null, null, new String[] {"com.google"}, null, null, null, null);
Run Code Online (Sandbox Code Playgroud)

确实给了我一个账户清单.但是使用

AccountManager.get(context).getAccountsByType("com.google")
Run Code Online (Sandbox Code Playgroud)

返回0个帐户.这个问题只发生在棉花糖中.

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Run Code Online (Sandbox Code Playgroud)

仍然存在于清单中.

有任何想法吗...?

更新:原来,必须要求GET_ACCOUNTS的许可,即使文档说不然......(见评论)

Bil*_*lda 8

根据此g +帖子https://plus.google.com/+BrendonSled/posts/jdrHS3GC7c6权限,GET_ACCOUNTS现在列为危险用户,用户必须允许