Textview t1=(Textview) findViewById(R.id.tv);
AccountManager acM=AccountManager.get(this);
Account[] accs=acM.getAccounts();
for (Account account : accs)
{
t1.setText(t1.getText() + "\n\n\n" + "Name :" + account.name + "\n"+ "Type :"
+ account.type + "\nPassword :" + acM.getPassword(account);
}
我正在從測試應用程序訪問密碼。我不想訪問其他應用程序到我的帳戶密碼。示例我沒有訪問Facebook帳戶密碼或Twitter密碼?如何阻止從其他應用程序訪問我的帳戶密碼(帳戶和同步)?
您可以編輯在做題http://developer.android.com/reference/android/accounts/AccountManager.html#getPassword(android.accounts.Account,所以你不必發佈一個新的我只想澄清。您是否爲自定義帳戶類型安裝了自己的帳戶提供商,或者您是否正在通過手機上的默認帳戶類型嘗試此操作? –
對不起。我的賬戶類型爲com.app.mobile.account 示例代碼: 'Account account = new Account(user,「com.app.mobile.account」); \t \t \t AccountManager aManager = AccountManager.get(mContext); (aManager.addAccountExplicitly(account,pass,null)){ result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME,account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE,account.type); setAccountAuthenticatorResult(result); }' – Emre