Start a new topic

kinveyDeleteResponse.getCount() always return 0 when OfflinePolicy is set

Hi,

I'm trying to delete entity from my collection by doing:   

appData.delete(query, new KinveyDeleteCallback() {
@Override
public void onSuccess(KinveyDeleteResponse kinveyDeleteResponse) {
Log.d(TAG, "Deleted successfully " + kinveyDeleteResponse.getCount() + " records");
Toast.makeText(getContext(), "Deleted " + kinveyDeleteResponse.getCount() + " records", Toast.LENGTH_SHORT).show();
}

@Override
public void onFailure(Throwable throwable) {
Log.e(TAG, "Failed to delete " + throwable.getMessage(), throwable);
Toast.makeText(getContext(), "Delete failed", Toast.LENGTH_SHORT).show();
}
});

  Everything works fine until I set Offline policy to my appData (according to guides here: http://devcenter.kinvey.com/android/guides/caching-offline#OfflineAppData). I've added a service to AndroidManifest and done sth like this:

AsyncAppData<MyEntity> appData = kinveyClient.appData(SAMPLE_COLLECTION, MyEntity.class);
appData.setOffline(OfflinePolicy.ONLINE_FIRST, new SqlLiteOfflineStore<UserEntity>(getContext()));

 

When I'm trying to delete entity after setting this OfflinePolicy I got this response:

D/HttpTransport: -------------- RESPONSE --------------

200 OK

Content-Length: 11

Content-Type: application/json; charset=utf-8

Date: Thu, 18 Feb 2016 13:01:43 GMT

Server: ngx_openresty

X-Android-Received-Millis: 1455800508409

X-Android-Response-Source: NETWORK 200

X-Android-Sent-Millis: 1455800508206

X-Kinvey-API-Version: 3

X-Kinvey-Request-Id: e72b730091f64364b152d5123ba3679f

X-Powered-By: Express

D/HttpTransport: Total: 11 bytes

D/HttpTransport: {"count":2}

and entities are actually deleted, but my log message says "Deleted successfully 0 records". This happens only after setting OfflinePolicy. Without it my log matches the response I see in HttpTransport logs. Where is that "count" value coming from then? 

1 Comment

The count value seems to be erroneously reporting 0 items being deleted rather than 2.   I will mark this as a bug.  


Thanks for reporting this to us.  


Enjoy your afternoon,

Login or Signup to post a comment