I am developing an Android application, and every time a user launches this application, it generates a new register (if it does not exist) from this user when updating existing data, and my application will insert additional information into the user node.
Every time I update this node, all other information is lost.
My custom class
@IgnoreExtraProperties public class User { public String userID; public String userName; public String userMail; public boolean active; public User() {} public User(String userID, String userName) { this.userID = userID; this.userName = userName; } public User(String userID, String userName, String userMail, boolean active) { this.userID = userID; this.userName = userName; this.userMail = userMail; this.active = active; } @Exclude public Map<String, Object> toMap() { HashMap<String, Object> result = new HashMap<>(); result.put("user_id", userID); result.put("name", userName); result.put("email", userMail); result.put("active", active); return result; } }
And my update code:
public class FireBaseUser { public static String FB_REFERENCE_USER = "user"; public void updateUser(String userID, String userName, String userMail, boolean userActive) {
When I call myRef.updateChildren(childUpdates); all my old data is updated, and my new children (which I created during the application) are lost.

source share