android从客户经理获取gmail用户名和密码

android从客户经理获取gmail用户名和密码,第1张

概述我正在为Android编写GMail客户端.我想在ListView中列出所有GMail帐户.当用户单击一个项目时,我希望程序检索相应帐户的密码.但是,我得到一个SecurityException:java.lang.SecurityException: caller uid 10107 is different than the authenticator'

我正在为Android编写GMail客户端.我想在ListVIEw中列出所有GMail帐户.当用户单击一个项目时,我希望程序检索相应帐户的密码.

但是,我得到一个SecurityException:

java.lang.SecurityException: caller uID 10107 is different than the authenticator's uID

这是我的代码:

AccountManager accountManager = AccountManager.get(context);this.username = account.name;this.password = accountManager.getpassword(account); //this is where I get the exception

我在AndroIDManifest.xml中拥有所有这些权限:

根据Android reference,唯一需要的权限应该是MANAGE_ACCOUNTS.

我的代码有什么问题?

最佳答案您可以获得authtoken,但无法获得用户的实际凭据.实际的信用只能由创建它们的应用程序访问.从getpassword方法的文档(强调我的):

This method requires the caller to hold the permission AUTHENTICATE_ACCOUNTS and to have the same UID as the account’s authenticator.

总结

以上是内存溢出为你收集整理的android从客户经理获取gmail用户名和密码全部内容,希望文章能够帮你解决android从客户经理获取gmail用户名和密码所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1139867.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)