I have custom authenticator. And put account information like it shown below:
final AccountManager am = AccountManager.get(AuthActivity.this);
final Bundle result = new Bundle();
final Bundle userData = new Bundle();
userData.putString(KEY_NAME, mName);
userData.putString(KEY_EMAIL, mEmail);
Account account = new Account(mLogin, vcs.getAccountType());
if (am.addAccountExplicitly(account, null, userData)) {
result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
result.putString(AccountManager.KEY_AUTHTOKEN, mAccessToken);
result.putString(KEY_REFRESH_TOKEN, mRefreshToken);
am.setAuthToken(account, account.type, mAccessToken);
} else {
result.putString(AccountManager.KEY_ERROR_MESSAGE, "F@ck|n8 authenticator");
}
setAccountAuthenticatorResult(result);
setResult(RESULT_OK);
finish();
But how I can get these custom values when I need it?
I try to get it so:
tvUsername.setText(accountManager.getUserData(account, AuthActivity.KEY_NAME));
tvEmail.setText(accountManager.getUserData(account, AuthActivity.KEY_EMAIL));
What I do wrong?