The app closes when the user leaves the account

Asked

Viewed 16 times

-2

When the user leaves the account the application closes.

The problem arose when I changed the rules of the Altime from that

{
  "rules": {
    ".read": true,
    ".write": true
  }
}

for that reason

{
  "rules": {
    ".read": "auth.uid != null",
    ".write": "auth.uid != null"
    }
}

LOG OUT BHUTAN

        button5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FirebaseAuth.getInstance().signOut();
                Intent intent = new Intent(getActivity(), MainActivity.class);
                startActivity(intent);
                getActivity().finishAffinity();
            }
        });

1 answer

0

try like this:

    button5.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            FirebaseAuth.getInstance().signOut(this).addOnCompleteListener(new OnCompleteListener<Void>() {
                public void onComplete(@NonNull Task<Void> task) {
                    // agora o usuário está deslogado
                    Intent intent = new Intent(getActivity(), MainActivity.class);
                    startActivity(intent);
                    getActivity().finishAffinity();
                }
            });
        }

Browser other questions tagged

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