Wer und wann sollte die Aufrufmethode bestätigt, dass die cractAccountAuthenticator-basierte Klasse bestätigt wird?

StackOverflow https://stackoverflow.com/questions/9341042

Frage

Ich verstehe nicht, wie Methode confirmCredentials Arbeiten. Ich habe noch nie Optionen in der Android -Benutzeroberfläche wie "Bestätigen Sie Anmeldeinformationen" oder so ähnlich gesehen. Es gibt nur "Konto erstellen" und "Konto entfernen".

War es hilfreich?

Lösung

Es wird verwendet, wenn Sie das Google Mail -Konto auf dem Gerät als Überprüfungsmethode verwenden möchten. NFCSecure verwendet es, wenn Sie die App öffnen, und zwingt Sie, sich mit Ihrem Google Mail anzumelden.

public void verifyAuth(Bundle b) throws IllegalArgumentException {
    accountManager.confirmCredentials(getImportantAccount(importantEmail), b, (Activity) c, new OnConfirmed(), null);
}


public void attemptLogin() {
    mEmailView.setError(null);
    mPasswordView.setError(null);

    mEmail = mEmailView.getText().toString();
    mPassword = mPasswordView.getText().toString();

    boolean cancel = false;
    View focusView = null;

    if (TextUtils.isEmpty(mPassword)) {
        mPasswordView.setError(getString(R.string.error_field_required));
        focusView = mPasswordView;
        cancel = true;
    } else if (mPassword.length() < 4) {
        mPasswordView.setError(getString(R.string.error_invalid_password));
        focusView = mPasswordView;
        cancel = true;
    }

    if (TextUtils.isEmpty(mEmail)) {
        mEmailView.setError(getString(R.string.error_field_required));
        focusView = mEmailView;
        cancel = true;
    } else if (!mEmail.contains("@")) {
        mEmailView.setError(getString(R.string.error_invalid_email));
        focusView = mEmailView;
        cancel = true;
    }

    if (cancel) {
        focusView.requestFocus();
    } else {
        mLoginStatusMessageView.setText(R.string.login_progress_signing_in);
        showProgress(true);
        gAuth = new GoogleAuthentication(ctx, mEmailView.getText().toString());
        gAuth.setUserConfirmedListener(SettingsUnlockActivity.this);

        Bundle b = new Bundle();
        b.putString(AccountManager.KEY_PASSWORD, mPasswordView.getText().toString());
        try {
            gAuth.verifyAuth(b);
        } catch (IllegalArgumentException e) {
            doUnSuccessfulLogin();
        }
    }
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top