Good morning, I'm having a hard time, I made an application using firebase authentication and every time the application is opened it asks for login, how do I keep this login active once it has been done and open the "restricted" part of the direct application? p>
Here's how the login method works:
private void startLogin() {
final ProgressDialog progressDialog;
progressDialog = new ProgressDialog(this, R.style.AppCompatAlertDialogStyle);
String email = mEmailField.getText().toString();
String password = mPasswordField.getText().toString();
if(TextUtils.isEmpty(email) || TextUtils.isEmpty(password)){
Toast.makeText(LoginActivity.this, "Campo vazio", Toast.LENGTH_LONG).show();
}else{
progressDialog.setMessage("Aguarde, entrando no aplicativo!");
progressDialog.show();
mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(!task.isSuccessful()){
Toast.makeText(LoginActivity.this, "Erro no login", Toast.LENGTH_LONG).show();
}else{
startActivity(new Intent(LoginActivity.this, DashActivity.class));
}
progressDialog.dismiss();
}
});
}
}
Thank you.