how to use FieldValue.serverTimestamp() to custom model class in android
After lots of research i found a solution for this.
@ServerTimestamp
private Date timestamp;
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
and when calling this class
UserModel userModel = new UserModel();
userModel.setEmail(email);
userModel.setPassword(password);
userModel.setName(name);
userModel.setUid(uid);
insertUserDataToFireStore(userModel);
This is the link where i found the solution Click here