Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中将AbstractAccountAuthenticator与AccountAuthenticatorActivity链接_Android - Fatal编程技术网

如何在android中将AbstractAccountAuthenticator与AccountAuthenticatorActivity链接

如何在android中将AbstractAccountAuthenticator与AccountAuthenticatorActivity链接,android,Android,官方文档说要在addAccount方法中返回一个bundle。这是干什么用的 @Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { Log.v("TAG", "ad

官方文档说要在addAccount方法中返回一个bundle。这是干什么用的

@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException {

    Log.v("TAG", "addAccount()");
    final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
    intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
    final Bundle bundle = new Bundle();
    bundle.putParcelable(AccountManager.KEY_INTENT, intent);


    return bundle;
}

我无法获取此AbstractAccountAuthenticator的实际工作流。我是否应该启动AccountAuthenticatorActivity作为启动器活动,并通过传递当前活动的上下文来调用AbstractAccountAuthenticator?如果是,何时调用addAccount方法?我应该在哪里调用API以在后端创建帐户?AbstractAccountAuthenticator将在哪里保存令牌?我应该如何从AbstractAccountAuthenticator访问该令牌?

当用户尝试从设置添加帐户时调用它。

当用户尝试从设置添加帐户时调用它