3
我的應用程序連接到使用OAuth授權的服務器。 我應該如何在帳戶管理器中存儲這些帳戶? 萬一我已經登錄並通過,它可以像下面:AccountManager和OAuth - 如何添加帳戶?
Account account = new Account("user1", context.getString(R.string.ACCOUNT_TYPE));
AccountManager am = AccountManager.get(context);
if (am.addAccountExplicitly(account, "pass1", null)) {
result = new Bundle();
Log.i(TAG, "account: "+account.name+", "+account.type);
result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
activity.setAccountAuthenticatorResult(result);
但是應該傳遞,而不是用戶名和傳遞OAuth的帳戶的情況下? 我應該在哪裏存儲OAuth祕密? OAuth令牌應該存儲在KEY_AUTHTOKEN中?