Reputation: 6621
What i found during testing of my application. I have copy some data to realm database and then from other process i.e. SyncAdapter the data is updated by copy or update method using realm.executeTransactionAsync call. As run the sync multiple time and remove the app from recents. The data is rollback to old data. Do any one have solution for this. Following is my code snippet:
final Realm realm = getRealm();
realm.executeTransactionAsync(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
for (GetProductPriceResModel priceResModel : resBeanList)
priceResModel.generateSearchData();
realm.copyToRealmOrUpdate(resBeanList);
realm.commitTransaction();
}
}, new Realm.Transaction.OnSuccess() {
@Override
public void onSuccess() {
if (callBack != null) callBack.onSuccess();
closeRealm(realm);
}
}, new Realm.Transaction.OnError() {
@Override
public void onError(Throwable error) {
if (callBack != null) callBack.onFailure(error);
}
});
Upvotes: 1
Views: 1286