When I signIn with my google account and get the name with the getDisplayName(), my name appear correctly, but in the AuthStateListener doesn\'t.
here part of my cod
I found a solution for this problem, in the Firebase documentation! The solution is to update the user profile using the: UserProfileChangeRequest:
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
.setDisplayName(mUser.getName())
.setPhotoUri(Uri.parse("https://example.com/mario-h-user/profile.jpg"))
.build();
firebaseUser.updateProfile(profileUpdates)
.addOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(@NonNull Task task) {
if (task.isSuccessful()) {
Log.d(TAG, "User profile updated.");
}
}
});
The variable mUser is already filled with the content from the fields. I used this piece of code inside the FirebaseAuth.AuthStateListener() -> onAuthStateChanged()