I have problem working with realm.
findAll and findAllAsync doesnot return any data from realm.
I am updating realm object from main thread like this.
public void updatePhoto(final int ticketID) {
realm.beginTransaction();
RealmResults ticketPhotos = realm.where(TicketPhoto.class).equalTo("TicketID", ticketID).findAll();`
for (TicketPhoto ticketPhoto : ticketPhotos) {
ticketPhoto.IsModified = true;
}
realm.commitTransaction();
} '$'
At same time one background service is running for every five minutes and keeps checking for any objects having IsModified flag as true. From my background service(IntentService), am using AsyncTask and in doInBackground, am trying to get those IsModified records and I assume realm should pick those records and update with my server. Used the below code to get data from realm.
public RealmResults getTicketPhotosToSave (){
return realm.where(TicketPhoto.class)
.equalTo("IsModified", true)
.findAll();
}
When am still in the same Photo activity where I save photo to realm with IsModified flag as true, realm in background service is not picking those records. But when I destroy the app and just run it again, service is now picking those records. Am not sure if am doing something wrong here.