【问题标题】:Android custom account retreive the passwordAndroid自定义账号找回密码
【发布时间】:2017-07-16 16:33:15
【问题描述】:

我根据文档创建了一个自定义帐户,我有一个扩展 AbstractAccountAuthenticator 和服务的类。

我添加一个这样的帐户:

    public static void addCustomAccount(Context context, String title, String password) {
        AccountManager accountManager = AccountManager.get(context);
        Account account = new Account(title, Constants.ACCOUNT_KEY);
        if (accountManager.addAccountExplicitly(account, password, null)) {
            Log.v(Constants.LOGTAG, "Account in Android Accounts was created");
        }
    }

一切正常,帐户显示在设置中。

我的问题是:

如何找回我在此过程中设置的密码?

【问题讨论】:

  • @cricket_007 抱歉打错了
  • @cricket_007 哎呀,我什至不能复制粘贴。现在应该好了...
  • AccountManager 类中有几个方法是“getAccounts”。你试过了吗?
  • @cricket_007 ofc。但是,如果我获得了我添加的正确帐户(这有效)account 对象没有字段或方法来检索密码

标签: android accounts


【解决方案1】:

似乎AccountManager#getPassword(Account account) 是您所需要的。

您也可以通过经理的getAccounts 方法获取您的Account 对象

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多