Each time the activity is called, it writes again. But I don't want him rewriting the premium part. How do I check the user ID to not rewrite the database? How do I query the user's identity in the database ?
public void writeFirebase() {
Users users = new Users();
if (mUser.getPhotoUrl() != null) {
users.setUserProfilPic(mUser.getPhotoUrl().toString());
}
if (mUser.getDisplayName() != null) {
users.setUserName(mUser.getDisplayName());
}
users.setUserId(mUser.getUid());
users.setUserPremium("false");
users.setUserPremiumDate("");
users.setUserEmail(mUser.getEmail());
myRef.child("Users").child(users.getUserId()).setValue(users);
}