在Firebase中获取用户名,姓氏和ID

编程入门 行业动态 更新时间:2024-10-11 09:23:23
本文介绍了在Firebase中获取用户名,姓氏和ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用firebase创建了一个登录/注册,并且工作正常.但是我需要从用户那里获取姓名和姓氏.我怎样才能做到这一点?我想知道是否有可能从用户那里获得ID,因为我想在我的应用中创建一个排名页面,因此只有ID是唯一的.

I created a login/register using firebase, and it's working fine. But I need to get name and lastname from the user. How can I do this? And I'd like to know if it's possible to get an ID from the user, because I want to create a Rank Page in my app, so only an ID would be unique to do this.

推荐答案

要获取唯一ID,您可以使用:

To get a Unique ID, you can use:

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); String uid = user.getUid();

要获取他的名字(我从未在Email/password auth中尝试过此操作,但在第三方提供者auth上可以正常使用):

To get his name (I never tried this in Email/password auth, but it works fine on 3rd party providers auth):

String name = user.getDisplayName();

更多推荐

在Firebase中获取用户名,姓氏和ID

本文发布于:2023-11-28 14:34:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642805.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:姓氏   用户名   Firebase   ID

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!