Reputation: 438
I want to synchronize the android application with server. In Server i have maintained last update date through trigger as it uses SQL server but my android application uses Realm so how can i set current date time in a field whenever any row is inserted or updated. Any suggestion would be highly appreciated.
Upvotes: 9
Views: 2565
Reputation: 1977
use this
realm.beginTransaction();
RealmResults<ModelClass> hallos = realm.where(ModelClass.class).equalTo('name', 'hello').findAll();
for (ModelClass object : hallos) {
object.setTimeStamp(timestamp);
}
realm.commitTransaction();
Upvotes: 2