Java Code Examples for com.firebase.ui.auth.ErrorCodes#NO_NETWORK

The following examples show how to use com.firebase.ui.auth.ErrorCodes#NO_NETWORK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StartupActivity.java    From Track-My-Location with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RC_LOGIN) {
        IdpResponse response = IdpResponse.fromResultIntent(data);
        if (resultCode == RESULT_OK) {
            goToMainActivity();
        } else {
            if (response == null) {
                Toast.makeText(this, "Login Failed", Toast.LENGTH_SHORT).show();
            } else if (response.getError().getErrorCode() == ErrorCodes.NO_NETWORK) {
                Toast.makeText(this, "No Network Connection", Toast.LENGTH_SHORT).show();
            }
        }
    }
}
 
Example 2
Source File: MainActivity.java    From quickstart-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RC_SIGN_IN) {
        IdpResponse response = IdpResponse.fromResultIntent(data);
        mViewModel.setIsSigningIn(false);

        if (resultCode != RESULT_OK) {
            if (response == null) {
                // User pressed the back button.
                finish();
            } else if (response.getError() != null
                    && response.getError().getErrorCode() == ErrorCodes.NO_NETWORK) {
                showSignInErrorDialog(R.string.message_no_network);
            } else {
                showSignInErrorDialog(R.string.message_unknown);
            }
        }
    }
}
 
Example 3
Source File: BaseAuthActivity.java    From q-municate-android with Apache License 2.0 6 votes vote down vote up
private void onReceiveFirebaseAuthResult(int resultCode, Intent data) {
        IdpResponse response = IdpResponse.fromResultIntent(data);

        // Successfully signed in
        if (resultCode == RESULT_OK) {
            firebaseAuthHelper.refreshInternalFirebaseToken(firebaseAuthCallback);
        } else {
             //Sign in failed
            if (response == null) {
                // User pressed back button
                Log.i(TAG, "BACK button pressed");
                return;
            }

            if (response.getErrorCode() == ErrorCodes.NO_NETWORK || response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) {
                showSnackbar(R.string.dlg_internet_connection_error, Snackbar.LENGTH_INDEFINITE);
            }
        }
}
 
Example 4
Source File: LoginActivity.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d(TAG, "GOT AN ACTIVITY RESULT");
    if (requestCode == RC_SIGN_IN) {
        Log.d(TAG, "IT WAS A SIGN IN RESULT");
        IdpResponse response = IdpResponse.fromResultIntent(data);

        // Successfully signed in
        if (resultCode == RESULT_OK) {
            logAuthEvent("phone");
            startThemeChooser();
            finish();
        } else {
            // Sign in failed
            if (response == null) {
                // User pressed back button
                showError("Sign in cancelled");
                return;
            }

            if (response.getError().getErrorCode() == ErrorCodes.NO_NETWORK) {
                showError("Sign in cancelled");
                return;
            }

            showError("Unknown Error");
            Log.e(TAG, "Sign-in error: ", response.getError());
        }
    }
}
 
Example 5
Source File: LoginActivity.java    From Stayfit with Apache License 2.0 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RC_SIGN_IN) {
        IdpResponse response = IdpResponse.fromResultIntent(data);
        if (resultCode == Activity.RESULT_OK) {
            Log.d(this.getClass().getName(), "This user signed in with " + response.getProviderType());
            startUpTasks();
            updateInfo();
        } else {
            // Sign in failed
            if (response == null) {
                // User pressed back button
                Toast.makeText(this, "Signin cancelled", Toast.LENGTH_SHORT).show();
                return;
            }

            if (response.getError().getErrorCode() == ErrorCodes.NO_NETWORK) {
                Toast.makeText(this, "Check network connection and try again", Toast.LENGTH_LONG).show();
                return;
            }

            Toast.makeText(this, "Unexpected Error, we are trying to resolve the issue. Please check back soon", Toast.LENGTH_LONG).show();
            Log.e(TAG, "Sign-in error: ", response.getError());
        }
    }
}
 
Example 6
Source File: AuthUiActivity.java    From FirebaseUI-Android with Apache License 2.0 5 votes vote down vote up
private void handleSignInResponse(int resultCode, @Nullable Intent data) {
    IdpResponse response = IdpResponse.fromResultIntent(data);

    // Successfully signed in
    if (resultCode == RESULT_OK) {
        startSignedInActivity(response);
        finish();
    } else {
        // Sign in failed
        if (response == null) {
            // User pressed back button
            showSnackbar(R.string.sign_in_cancelled);
            return;
        }

        if (response.getError().getErrorCode() == ErrorCodes.NO_NETWORK) {
            showSnackbar(R.string.no_internet_connection);
            return;
        }

        if (response.getError().getErrorCode() == ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT) {
            Intent intent = new Intent(this, AnonymousUpgradeActivity.class).putExtra
                    (ExtraConstants.IDP_RESPONSE, response);
            startActivity(intent);
        }

        if (response.getError().getErrorCode() == ErrorCodes.ERROR_USER_DISABLED) {
            showSnackbar(R.string.account_disabled);
            return;
        }

        showSnackbar(R.string.unknown_error);
        Log.e(TAG, "Sign-in error: ", response.getError());
    }
}