firebaseAuth.getCurrentUser() return null DisplayName

前端 未结 9 1887
[愿得一人]
[愿得一人] 2020-12-09 05:24

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

9条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-09 06:10

    This is a tricky one since it is not so clear in the documentation...

    Check the getProviderData()

    as defined here: https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser#public-method-summary

    You can iterate that List and it will have all the providers associated with that account, included a provider with the providerId = "google.com" with a display Name = YOUR_GOOGLE_USERNAME

    let me know if you cannot make it work

提交回复
热议问题