M
M
Michael2019-06-24 12:01:33
Android
Michael, 2019-06-24 12:01:33

firebase authentication not working in android studio app?

I will give a link to the git: https://github.com/HoboHub/gramophone_login
The problem is most likely in the MainActivity:
https://github.com/HoboHub/gramophone_login/tree/m...
What is the point: When you enter the application - only the registered user is thrown into SetupActivity where he enters his data (country, name, nickname). After it should be thrown into MainActivity, marked: registration successful, congratulations!!!
In fact: Only congratulations pop up. The user is transferred to MainActivity for half a second and then enter data back into Setup.
Here is the code from Main.
If there is no user data in the Firebase database, it is thrown into SetUpActivity.

private void CheckUserExistence() {
        final String current_user_id = mAuth.getCurrentUser().getUid();
        UsersRef.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                if (!dataSnapshot.hasChild(current_user_id)) {
                    SendUserToSetupActivity();
                }
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {

            }
        });
    }

I thought to do it through else (if there is data, then ...), but it's not clear to me what to write, because the user initially starts from MainActivity and, in fact, if he is authorized, he must remain there.
SetUpActivity
5d109125ef7e6623811825.png
Second transfer to Main and back
5d109130d9ba8781882621.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2019-06-24
@Misha5

Okay, I figured out what the problem is. I put quotes in the wrong place in SetUpActivity

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question