简体   繁体   English

记录所有用户帐户和密码?

[英]Log all user accounts and passwords?

This is strictly for testing purposes. 这仅用于测试目的。 I am not building this into an application. 我没有把它构建成一个应用程序。

I am trying to log all the user's saved accounts and passwords 我正在尝试记录所有用户保存的帐户和密码

    AccountManager accountManager = AccountManager.get(this);   

    for(Account account : accountManager.getAccounts())
    {
        System.out.println(account.name + " : " + accountManager.getPassword(account));
    }

But I am getting an error 但是我收到了一个错误

E/AndroidRuntime(11944): java.lang.SecurityException: caller uid XXXXX is different than the authenticator's uid E / AndroidRuntime(11944):java.lang.SecurityException:调用者uid XXXXX与身份验证者的uid不同

I have read this question but it doesn't really explain how to get around this problem, just to avoid it, at least I think so. 我已经阅读了这个问题,但它并没有真正解释如何解决这个问题,只是为了避免它,至少我是这么认为的。

Is there a way around this issue? 有没有解决这个问题的方法?

Thanks in advance 提前致谢

This happend because you can't obtain the accounts of a device at this way. 发生这种情况是因为您无法以这种方式获取设备的帐户。 This only works if you previously add an account to the AccountManager, and you want retrieve it later. 这仅适用于您之前将帐户添加到AccountManager,并且您希望以后检索它。

That's the reason why is telling you that haven't got the right permission. 这就是为什么告诉你没有得到正确许可的原因。

To know the accounts added in the device should use, for example: 要知道设备中添加的帐户应使用,例如:

AccountManager accountManager = AccountManager.get(this);
Account[] accounts = accountManager.getAccounts();
accountManager.getUserData(accounts[0], AccountManager.KEY_USERDATA);

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM