Show Progressibar when logging into Firebase

Asked

Viewed 277 times

0

When logging in, I want a load bar to appear while the login is being done. How do I get the process (time, size...) of Firebase to increment in the progress bar?

Follow the login code:

private void efetuarLogin() {
    final FirebaseAuth autenticacaoFirebase = ConfiguracaoFirebase.getFirebaseAuth();
    autenticacaoFirebase.signInWithEmailAndPassword(
            usuario.getEmail(),
            usuario.getSenha()
    ).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
        @Override
        public void onComplete(@NonNull Task<AuthResult> task) {
            if (task.isSuccessful()) {
             //   FirebaseUser firebaseUser = autenticacaoFirebase.getCurrentUser();
                telaPrincipal();
            } else {
                String erroExcecao = "";
                try {
                    throw task.getException();
                } catch (FirebaseAuthInvalidCredentialsException e) {
                    erroExcecao = "E-mail inválido e/ou senha incorreta";
                    MetodosAuxiliares.Alert(LoginActivity.this, erroExcecao);
                } catch (Exception e) {
                    e.printStackTrace();
                    MetodosAuxiliares.Alert(LoginActivity.this, "Verifique seu e-mail e/ou senha");
                }
            }
        }
    });

}

1 answer

0


In the first line of the method efetuarLogin() add:

final ProgressDialog dialog = ProgressDialog.show(this, "Titulo", "Texto", true);

Then inside your own onComplete() add:

dialog.dismiss();
  • 1

    Although this shows a Progressdialog, I do not believe that there is a way to recover the current progress of Sign in

  • Hello, it even worked, but it’s depreciated. Thanks anyway.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.