Example usage for android.accounts AccountManager ERROR_CODE_CANCELED

List of usage examples for android.accounts AccountManager ERROR_CODE_CANCELED

Introduction

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

Prototype

int ERROR_CODE_CANCELED

To view the source code for android.accounts AccountManager ERROR_CODE_CANCELED.

Click Source Link

Usage

From source file:authenticatorStuff.AccountAuthenticatorActivity.java

/**
 * Sends the result or a Constants.ERROR_CODE_CANCELED error if a result isn't present.
 *//*www . java 2 s . c o  m*/
public void finish() {
    if (mAccountAuthenticatorResponse != null) {
        // send the result bundle back if set, otherwise send an error.
        if (mResultBundle != null) {
            mAccountAuthenticatorResponse.onResult(mResultBundle);
        } else {
            mAccountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");
        }
        mAccountAuthenticatorResponse = null;
    }
    super.finish();
}

From source file:com.ntsync.android.sync.activities.AbstractAuthenticatorActivity.java

/**
 * Sends the result or a Constants.ERROR_CODE_CANCELED error if a result
 * isn't present./*w ww  . j  av  a 2 s . c  o  m*/
 */
@Override
public void finish() {
    if (mAccountAuthenticatorResponse != null) {
        // send the result bundle back if set, otherwise send an error.
        if (mResultBundle != null) {
            mAccountAuthenticatorResponse.onResult(mResultBundle);
        } else {
            mAccountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");
        }
        mAccountAuthenticatorResponse = null;
    }
    super.finish();
}

From source file:drupalfit.sample.ToolBarActivity.java

@Override
public void finish() {
    if (mAccountAuthenticatorResponse != null) {
        // send the result bundle back if set, otherwise send an error.
        if (mResultBundle != null) {
            mAccountAuthenticatorResponse.onResult(mResultBundle);
        } else {//from  w  w  w. j av a2s  . c o  m
            mAccountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");
        }
        mAccountAuthenticatorResponse = null;
    }
    super.finish();
}

From source file:com.nextgis.maplibui.activity.NGWLoginActivity.java

public void finish() {
    if (mAccountAuthenticatorResponse != null) {
        // send the result bundle back if set, otherwise send an error.
        if (mResultBundle != null) {
            mAccountAuthenticatorResponse.onResult(mResultBundle);
        } else {//  w  w w.ja v  a 2s.  co m
            mAccountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED,
                    getString(R.string.canceled));
        }
        mAccountAuthenticatorResponse = null;
    }
    super.finish();
}

From source file:com.ubuntuone.android.files.activity.LoginActivity.java

@Override
public void finish() {
    if (mAccountAuthenticatorResponse != null) {
        if (mResultBundle != null) {
            Log.d(TAG, "Setting authenticator response.");
            mAccountAuthenticatorResponse.onResult(mResultBundle);
        } else {//from  w  w  w  . j  ava  2s. c  o m
            Log.d(TAG, "Canceled, not setting authenticator response.");
            mAccountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");
        }
        mAccountAuthenticatorResponse = null;
    }
    super.finish();
}

From source file:org.andstatus.app.account.AccountSettingsActivity.java

/** 
 * Mark the action completed, close this activity and go back to the proper screen.
 * Return result to the caller if necessary.
 * See also {@link com.android.email.activity.setup.AccountSetupBasics.finish}
 * /*from   www .  j a va  2 s .c o  m*/
 * @return
 */
private void closeAndGoBack() {
    // Explicitly save MyAccount only on "Back key" 
    state.builder.save();
    String message = "";
    state.actionCompleted = true;
    overrideBackActivity = true;
    if (state.authenticatiorResponse != null) {
        // We should return result back to AccountManager
        overrideBackActivity = false;
        if (state.actionSucceeded) {
            if (state.builder.isPersistent()) {
                // Pass the new/edited account back to the account manager
                Bundle result = new Bundle();
                result.putString(AccountManager.KEY_ACCOUNT_NAME, state.getAccount().getAccountName());
                result.putString(AccountManager.KEY_ACCOUNT_TYPE, AuthenticatorService.ANDROID_ACCOUNT_TYPE);
                state.authenticatiorResponse.onResult(result);
                message += "authenticatiorResponse; account.name=" + state.getAccount().getAccountName() + "; ";
            }
        } else {
            state.authenticatiorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");
        }
    }
    // Forget old state
    state.forget();
    if (!mIsFinishing) {
        MyLog.v(this, "finish: action=" + state.getAccountAction() + "; " + message);
        mIsFinishing = true;
        finish();
    }
}

From source file:com.microsoft.aad.adal.AuthenticationActivity.java

/**
 * Sends the result or a Constants.ERROR_CODE_CANCELED error if a result
 * isn't present./*  w ww.  jav a  2 s. c o  m*/
 */
@Override
public void finish() {
    // Added here to make Authenticator work with one common code base
    if (isBrokerRequest(getIntent()) && mAccountAuthenticatorResponse != null) {
        // send the result bundle back if set, otherwise send an error.
        Logger.v(TAG, "It is a broker request");
        if (mAuthenticatorResultBundle != null) {
            mAccountAuthenticatorResponse.onResult(mAuthenticatorResultBundle);
        } else {
            mAccountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED, "canceled");
        }
        mAccountAuthenticatorResponse = null;
    }
    super.finish();
}