title: Get firebase user id in android
body: <p>After register with Firebase phone number (sms), I can get <code>user_id</code> and friends list from <code>user_id</code>, etc. But after I exit from app, and then re-enter the app return null <code>(FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();)</code> I cannot not get Firebase <code>user id</code> (firebaseUser return null). <code>implementation 'com.google.firebase:firebase-auth:21.0.1'</code> Plz... How to solve a problem?</p>
  <pre><code>FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
  if (firebaseUser != null) { // return null
      DatabaseReference reference1 = FirebaseDatabase.getInstance().getReference(&quot;Users&quot;).child(firebaseUser.getUid());
      reference1.addValueEventListener(new ValueEventListener() {
          @Override
          public void onDataChange(@NotNull DataSnapshot dataSnapshot) {
              User user = dataSnapshot.getValue(User.class);
          }
  
          @Override
          public void onCancelled(@NotNull DatabaseError databaseError) {
          }
      });
  }
  </code></pre>