如何在 Firebase 中将电子邮件地址添加为孩子?

编程入门 行业动态 更新时间:2024-10-28 00:19:06
本文介绍了如何在 Firebase 中将电子邮件地址添加为孩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在开发一个 Android 应用程序,我想要一个类似 Firebase 的数据库

I am working on an Android App where I want a Firebase database like

基本上,我想在应用程序上创建用户之前验证电子邮件.每当用户在我的应用程序中注册时,首先会检查电子邮件地址是否在 用户 数据库参考中可用.如果可用,那么只有他被允许注册.但我发现 Firebase 小时候不允许发送电子邮件.那么我该怎么做呢?在 Firebase 数据库中实现此目标的任何其他建议.

Basically, I want to verify email before creating a user on the app. Whenever a user registers in my app, First it will be checked whether the email address is available in the users database reference. if available, then only he is allowed to register. But I found that Firebase doesn't allow an email as a child. So How can I do it? Any other suggestion for achieving this in Firebase Database.

推荐答案

因为 Firebase 不允许在 key 中使用符号作为 .,我建议你像这样编码电子邮件地址:

Because Firebase does not allow symbols as . in the key, I suggest you encode the email address like this:

name@email -> name@email,com

name@email -> name@email,com

正如您可能看到的,不是 . 我使用了 ,.为此,您可以使用以下方法:

As you probably see, instead of . I have used ,. To achieve this, you can use the following methods:

static String encodeUserEmail(String userEmail) { return userEmail.replace(".", ","); } static String decodeUserEmail(String userEmail) { return userEmail.replace(",", "."); }

更多推荐

如何在 Firebase 中将电子邮件地址添加为孩子?

本文发布于:2023-11-15 17:42:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1596603.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中将   电子邮件地址   孩子   如何在   Firebase

发布评论

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

>www.elefans.com

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