There is a certain base FireBase Real-time Database.
EmainAuth.java
private void writeNewUser(String userId, String email) { // TODO FIX BUG: CANNOT SEND AN EMAIL TO FIREBASE DB Log.d(TAG, "Email in writeNewUser(): " + email); UserAccount user = new UserAccount(email); mDatabase = FirebaseDatabase.getInstance().getReference(); mDatabase.child("Users").child(userId).setValue(user); } UserAccount.java
import android.util.Log; public class UserAccount { public final static String TAG = "tag"; String username; int rating; String email; public UserAccount(){} public UserAccount(String email){ // TODO CHECK WHAT'S WRONG- EMAIL COULD BE EMPTY Log.d(TAG, "Email is UserAccount constructor: " + email); this.email = email; this.rating = 1; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public int getRating() { return rating; } public void setRating(int rating) { this.rating = rating; } } What is displayed in the console:
Email in writeNewUser (): jxgdiy@idgdgu.hx
Email is UserAccount constructor: jxgdiy@idgdgu.hx
As a result, only this enters the database:
{ "Users" : { "G5bIG92W4sS3XFtdKFqAUVGAfm43" : { "rating" : 1 } } } Where does the email field go? And in general, before it was necessary to send 2 lines, and both of them were sent. How to make lines appear in the Firebase Database?