Code example for AccountManager

Methods: addAccount

0
                @Override 
                public void run(AccountManagerFuture<Bundle> result) {
                    onAccountCreationFinished(actionContext, loginCallback, result);
                } 
            }; 
            accountManager.addAccount(MANAGED_ACCOUNT_TYPE, AUTH_TOKEN_TYPE, null, null, actionContext.getActivity(), c, null);
        } else { 
            if (!wasLastLoginWithCredentials()) { 
                invalidateCache(); 
            } 
            credentialsAccountHandler.promptAccount(actionContext, loginCallback);
        } 
    } 
 
    private void onAccountCreationFinished(final ActionContext actionContext, LoginCallback loginCallback,
                                           AccountManagerFuture<Bundle> result) {
        assert result.isDone();
        try { 
            final Bundle b = result.getResult();
            authenticate(loginCallback, new Account(
                    b.getString(AccountManager.KEY_ACCOUNT_NAME),