Skip to content

VMXFoundry.OfflineObjects.reset

Offline objects reset function resets device database to the initial stage of the sync environment. Once the reset is successful, all data is removed from the database but the database table structure is preserved.

Note: Reset requires network connection, and it fetches the latest Volt MX Foundry app schema.

Volt MX Iris (JavaScript)

Signature

VMXFoundry.OfflineObjects.reset(options, successCallback, failureCallback)

Input Parameters

ParameterTypeDescriptionRequired
optionsJSONReset options such as device database, encryption passphrase and so on.Yes
successCallbackFunctionThe function is invoked on successful reset.Yes
failureCallbackFunctionThe function is invoked on an error with the cause of failure as an argument.Yes

Setup Options

Option Type Description Required
deviceDbEncryptionKey String Encryption passphrase must be a string with at least six characters long. For more information, refer Offline Objects Getting Started Guide.
Note: Not applicable for Mobile Web and Desktop Web channels.
No
deviceDbPath String Device database is created at the given deviceDbPath location. The default Offline Objects database path for Windows Kiosk applications is C:\Users\User\AppData\Local. You can use the deviceDbPath option to override the default path. This options helps you to install more than one Offline enabled application by using the Offline Objects database at desired location.
Important: The default Offline Objects database location for Windows Kiosk is C:\Users\User\AppData\Local\AppID\Database. This impacts application upgrades that were built with the earlier versions of plugin. To retain the existing Offline Objects database, rebuild the Kiosk application with the deviceDbPath option and pass the C:\Users\User\AppData\Local location as an input to the setup, reset, and drop APIs.
Note: Not supported for Desktop Native channel.
No
treatBooleanFieldValuesAsNumeric Boolean If the treatBooleanFieldValuesAsNumeric key is set to false, all the boolean field values are converted to boolean type (true or false) during upload session or on reading records from local device database. When the option is set to true, fallbacks to default implementation (uploading and reading boolean field values as numeric). By default, the key is set to True. No

Return Type

void

Error Codes

Error CodeError Text
106Claims token is unavailable.

Example

function successCallback(status) {
voltmx.print("Application reset successful");
}

function failureCallback(error) {
voltmx.print("Application reset failed with error:" + error.code);
}

//Decrypt and re encrypt the device database
Var options = {
"deviceDbENcryptionKey": "myencryptionpa$$phrase1"};
VMXFoundry.OfflineObjects.reset(options,successCallback, failureCallback);

Android (Java)

Signature

void <OfflineObjects>.reset(final HashMap<String, object>options, final VMXCallback callback)

Parameters

ParameterTypeDescriptionRequired
optionsHashMap<String, object>Reset options such as device database, encryption passphrase and so on.Yes
callbackVMXCallbackApplication implements onSuccess and onFailure methods of VMXCallback interface.Yes

Reset Options

Option Type Description Required
deviceDbEncrytionKey String Encryption passphrase must be a string with at least six characters long. For more information, refer Offline Objects Getting Started Guide. No
treatBooleanFieldValuesAsNumeric Boolean If the treatBooleanFieldValuesAsNumeric key is set to false, all the boolean field values are converted to boolean type (true or false) during upload session or on reading records from local device database. When the option is set to true, fallbacks to default implementation (uploading and reading boolean field values as numeric). By default, the key is set to True. No

Return Type

void

Error Codes

Error CodeError Text
106Claims token is unavailable.

Example

VoltMXClient sdk = new VoltMXClient();
IVoltMXApplicationSync appSync = sdk.getOfflineObjects();

//Decrypt and re-encrypt the device database
HashMap < String, object > options = new HashMap < String, object > ();
options.put("deviceDbEncryptionKey", "myencryptionpa$$phrase1");
appSync.reset(options, new VMXCallback() {
@Override
public void onSuccess(Object object) {
Log.d("Application Reset", "Application reset successful");

    }

    @Override
    public void onFailure(Object error) {
        OfflineObjectsException e = (OfflineObjectsException) error;
        Log.e("Application Reset", "Application reset failed with error :" + e.getMessage());

    }

});

iOS (Objective C)

Signature

void <OfflineObjects> reset: (NSDictionary *)options  
onSuccess:(VMXSuccessCompletionHandler)onSuccess  
onFailure:(VMXFailureCompletionHandler)onFailure

Parameters

ParameterTypeDescriptionRequired
optionsNSDictionary<NSString*,id>Reset options such as device database, encryption passphrase and so on.Yes
onSuccessVMXSuccessCompletionHandlerThe function invoked on successful reset.Yes
onFailureVMXFailureCompletionHandlerThe function is invoked on reset failure with the cause of failure as an argument.Yes

Reset Options

Option Type Description Required
devcieDbEncryptionKey NSString Encryption passphrase must be at least six characters long. For more information, refer Offline Objects Getting Started Guide. No
treatBooleanFieldValuesAsNumeric Boolean If the treatBooleanFieldValuesAsNumeric key is set to false, all the boolean field values are converted to boolean type (true or false) during upload session or on reading records from local device database. When the option is set to true, fallbacks to default implementation (uploading and reading boolean field values as numeric). By default, the key is set to True. No

Return Type

void

Error Codes

Error CodeError Text
106Claims token is unavailable.

Example

VMXClient * sdk = [VMXClient sharedClient];

OfflineObjects * applicationSync = [sdk getOfflineObjects];

//Decrypt and re-encrypt the device database
NSMutableDictionary < NSString _ , id > _ options = [NSMutableDictionary new];
[options setObject: @"myencryptionpa$$phrase1"
forKey: @"deviceDbEncryptionKey"
];

VMXSuccessCompletionHandler onSuccess = ^ void(id object) {
NSLog(@"Application reset successful");
};

VMXFailureCompletionHandler onFailure = ^ void(id object) {
NSLog(@"Application reset failed");
};

[applicationSync reset: options
onSuccess: OnSuccess
onFailure: onFailure
];