How to add email address as child in Firebase?

android, firebase, firebase-authentication, firebase-realtime-database

Solution

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

name@email.com -> 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(",", ".");
}

Problem

I am working on an Android App where I want a Firebase database like 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.

Original source

Related problems