Firebase获取姓名
问题描述:
我的问题:Firebase获取姓名
我做了一个小的Android应用程序,在那里你可以注册并使用Firebase身份验证系统登录。 我把它想:
private FirebaseAuth firebaseAuth;
firebaseAuth = FirebaseAuth.getInstance()
然后我用firebaseAuth.signinwithEmailAndPassword。现在我的问题:我可以从用户的电子邮件帐户中获得名字和姓氏吗? 像在YouTube上的评论:例如:
名字姓氏:尼斯视频
这不是电子邮件地址是在这里,但在第一个和最后的名字, 问候
答
你可以从他们的个人资料中获取用户的姓名。来自Firebase documentation on reading the user profile:
要获取用户的配置文件信息,请使用
FirebaseUser
实例的存取器方法。例如:FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user != null) { // Name, email address, and profile photo Url String name = user.getDisplayName(); String email = user.getEmail(); Uri photoUrl = user.getPhotoUrl(); // Check if user's email is verified boolean emailVerified = user.isEmailVerified(); // The user's ID, unique to the Firebase project. Do NOT use this value to // authenticate with your backend server, if you have one. Use // FirebaseUser.getToken() instead. String uid = user.getUid(); }
谢谢你,我已经知道这一点,这是不是那个意思,我想:/ –
在你可能想澄清你的问题的话。 –
@FrankvanPuffelen有没有办法只得到名字?如果你在每个空间分割字符串,你可能会明白,但是有些名字(例如日语)没有空格。 – MScott