Example usage for android.accounts AccountManager addAccount

List of usage examples for android.accounts AccountManager addAccount

Introduction

In this page you can find the example usage for android.accounts AccountManager addAccount.

Prototype

public AccountManagerFuture<Bundle> addAccount(final String accountType, final String authTokenType,
        final String[] requiredFeatures, final Bundle addAccountOptions, final Activity activity,
        AccountManagerCallback<Bundle> callback, Handler handler) 

Source Link

Document

Asks the user to add an account of a specified type.

Usage

From source file:net.heroicefforts.viable.android.rep.it.GIssueTrackerRepository.java

private void manageAccount() {
    AccountManager accMgr = (AccountManager) act.getSystemService(Context.ACCOUNT_SERVICE);
    if (Config.LOGD)
        Log.d(TAG, "Requesting account creation.");
    Account[] accts = accMgr.getAccountsByType(GCLAccountAuthenticator.ACCT_TYPE);
    if (accts.length > 0)
        accMgr.confirmCredentials(accts[0], null, act, callback, null);
    else//  w  w w. ja v a 2  s.  c om
        accMgr.addAccount(GCLAccountAuthenticator.ACCT_TYPE, GCLAccountAuthenticator.TOKEN_TYPE_ISSUE_TRACKER,
                null, null, act, callback, null);
}

From source file:com.synox.android.ui.activity.FileActivity.java

/**
 * Launches the account creation activity. To use when no ownCloud account is available
 *///from  w  w  w .  j a  va2 s. co m
private void createFirstAccount() {
    AccountManager am = AccountManager.get(getApplicationContext());
    am.addAccount(MainApp.getAccountType(), null, null, null, this, new AccountCreationCallback(), null);
}