getAccountsByType不会在棉花糖中返回任何内容 [英] getAccountsByType does not return anything in marshmallow

查看:160
本文介绍了getAccountsByType不会在棉花糖中返回任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在这很奇怪...

使用

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")

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

returns 0 accounts. The problem only happens in marshmallow.

<uses-permission android:name="android.permission.GET_ACCOUNTS" />

清单中仍然存在.

有什么想法吗??

更新: 事实证明,即使文档另有说明,也必须征得GET_ACCOUNTS的许可...(请参阅评论)

UPDATE: Turns out, must ask permission for GET_ACCOUNTS, even though docs say otherwise... (see comments)

推荐答案

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

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

这篇关于getAccountsByType不会在棉花糖中返回任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆