I am trying to delete feature from secured ArcGIS feature layer using apply edits by passing a graphic array as input, but it is showing me the error
unable to complete operation, no adds, updates or deletes were specified.
Also, if I pass the same graphic for update operation then it is being updated successfully.
Following is the code snippet:
Map<String, Object> graphicAttributes = new HashMap<String, Object>();
graphicAttributes.put("OBJECTID", 65);
Graphic mfinalGraphic = new Graphic(null, null, graphicAttributes);
arcGISFeatureLayer.applyEdits(null, new Graphic[]{mfinalGraphic}, null,
new CallbackListener<FeatureEditResult[][]>() {
@Override
public void onCallback(final FeatureEditResult[][] featureEditResults) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MainActivity.this, "Successfully deleted", Toast.LENGTH_LONG).show();
}
} );
}
@Override
public void onError(final Throwable throwable) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MainActivity.this, "Failed to delete", Toast.LENGTH_LONG).show();
}
});
}
});
While tracking on fiddler, I am getting the following request:
f=json&deletes=&token=BY26ICX0-KN....
The problem is at rest end if I pass only the object id in f=json&deletes=7&token=BY26ICX0-KN.... then it is getting deleted successfully.
But there is no way of passing only object id in applyEdits for delete part in Android API. As applyEdits
expects only Graphics.