2
I have the following code that should return the user data logged in by Firebase, it returns the user without any problem, the ID and the Email, but the value of the name returns empty or null. As if the user with no name was registered, but the user’s name is usually included in the register. Does anyone know why? I already searched and it seems that there is a bug with getDisplayName from Firebase. 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;
}
C.Oli, has any solution worked for you? Leave it commented here if yes or if no, please to help others who find this same problem.
– Pedro Gaspar
I managed to solve by deleting the profiles already created and creating again, it started to return normally the value of the name. With the method of dislodging and re-logging tbm works.
– user128653
Using
FirebaseUser.getProviderData()
didn’t work for me– user128653