更新时间:2023-01-27 14:35:54
您可以将该ID作为用户对象的属性存储在数据库中,但更优雅的方法是使用uid
而不是该随机密钥由push()
方法提供.因此,一旦通过身份验证,就可以使用以下代码行获取uid
:
You can store that id in the database as a property of your User object but a more elegant way would be to use the uid
and not that random key provided by the push()
method. So once you are authenticated, you can get the uid
, using the following line of code:
String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();