VMXFoundry.OfflineObjects.rollback
Offline Objects rollback function rolls back all changes of the application in the device local database to its previous sync state.
Volt MX Iris (JavaScript)
Signature
VMXFoundry.OfflineObjects.rollback(successCallback, failureCallback)
Input Parameters
Parameter | Type | Description | Required |
successCallback | Function | The function is invoked on successful rollback. | Yes |
failureCallback | Function | The function is invoked on rollback failure with the cause of failure as an argument. | Yes |
Return Type
void
Example
function successCallback(result) {
//result contains boolean true
voltmx.print("Application rollback successful");
}
function failureCallback(error) {
voltmx.print("Application rollback failed with error:" + error.code);
}
VMXFoundry.OfflineObjects.rollback(successCallback, failureCallback);
Android (Java)
Signature
void <OfflineObjects>.rollback(final VMXCallback callback)
Parameters
Parameter | Type | Description | Required |
callback | VMXCallback | Application implements onSuccess and onFailure methods of VMXCallback interface. | Yes |
Return Type
void
Example
VoltMXClient sdk = new VoltMXClient();
IVoltMXApplicationSync appSync = sdk.getOfflineObjects();
appSync.rollback(new VMXCallback() {
@Override
public void onSuccess(Object object) {
Log.d("Application Rollback", "Application Rollback Successful");
}
@Override
public void onFailure(Object error) {
OfflineObjectsException e = (OfflineObjectsException) error;
Log.e("Application Rollback ", "Application Rollback failed with error :" + e.getMessage());
}
});
iOS (Objective C)
Signature
void <OfflineObjects> rollback:(VMXSuccessCompletionHandler)onSuccess
onFailure:(VMXFailureCompletionHandler)onFailure
Parameters
Parameter | Type | Description | Required |
onSuccess | VMXSuccessCompletionHandler | The function invoked on successful rollback. | Yes |
onFailure | VMXFailureCompletionHandler | The function is invoked on rollback failure with the cause of failure as an argument. | Yes |
Return Type
void
Example
VMXClient _ sdk = [VMXClient sharedClient];
OfflineObjects _ applicationSync = [sdk getOfflineObjects];
VMXSuccessCompletionHandler onSuccess = ^ void(id object) {
NSLog(@"Application rollback successful");
};
VMXFailureCompletionHandler onFailure = ^ void(id object) {
NSLog(@"Application rollback failed");
};
[applicationSync rollback: onSuccess onFailure: onFailure];