Skip to content

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)

Note:
  • Supported for iOS and Android channels from V8 SP2 onwards.
  • Supported for all channels from V8 SP4 onwards.

Signature

VMXFoundry.OfflineObjects.rollback(successCallback, failureCallback)

Input Parameters

ParameterTypeDescriptionRequired
successCallbackFunctionThe function is invoked on successful rollback.Yes
failureCallbackFunctionThe 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

ParameterTypeDescriptionRequired
callbackVMXCallbackApplication 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

ParameterTypeDescriptionRequired
onSuccessVMXSuccessCompletionHandlerThe function invoked on successful rollback.Yes
onFailureVMXFailureCompletionHandlerThe 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];