I have the following code that should return the user data logged in by Firebase, it returns the user with no problem, ID and Email, but the value of the name returns empty or null. As if the unnamed user was registered, but the user name usually appears in the registry. Does anyone know why? I already searched it and it looks like it has some bug with the Firebase getDisplayName. Already got a solution?
public static FirebaseUser getUsuarioAtual() {
FirebaseAuth usuario = ConfiguracaoFirebase.getFirebaseAutenticacao();
return usuario.getCurrentUser();
}
public static Usuario getDadosUsuarioLogado() {
FirebaseUser firebaseUser = getUsuarioAtual();
Usuario usuario = new Usuario();
usuario.setId(firebaseUser.getUid());
usuario.setEmail(firebaseUser.getEmail());
usuario.setNome(firebaseUser.getDisplayName());
return usuario;
}