VMXFoundry.OfflineObjects.setup
Offline Objects setup function initializes the creation of device database and sync environment. After the setup is successful, the database structure is created without any data in the device database. After the client database is created, subsequent calls to VMXFoundry.OfflineObjects setup initializes the sync environment.
Before performing any offline operation other thanĀ dropĀ or reset, invoke either setup() or incrementalSetup() API.
Note: Initial setup (launching after first time installation (after drop or reset)) requires network connection. Subsequent setups can initialize offline environment without network connectivity.
Volt MX Iris (JavaScript)
Signature
VMXFoundry.OfflineObjects.setup(options, successCallback, failureCallback)
Input Parameters
Parameter | Type | Description | Required |
options | JSON | Setup options such as device database, encryption passphrase and so on. | Yes |
successCallback | Function | The function is invoked on successful setup. | Yes |
failureCallback | Function | The function is invoked on setup failure 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 to 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. Note: This parameter is supported only for Windows Kiosk applications from V8 SP4 Fix Pack 44 onwards. 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 pluginTo 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 Code | Error Text |
106 | Claims token is unavailable. |
Example
function successCallback(status) {
voltmx.print("Application setup successful");
}
function failureCallback(error) {
voltmx.print("Application setup failed with error:" + error.code);
}
//Encrypt the device database using a passphrase
var options = {
"deviceDbEncryptionKey": "myencryptionpa$$phrase1"
};
VMXFoundry.OfflineObjects.setup(options, successCallback, failureCallback);
Android (Java)
Signature
void <OfflineObjects>.setup(final HashMap<String, object> options, final VMXCallback callback)
Parameters
Parameter | Type | Description | Required |
options | HashMap<String, Object> | Setup options such as device database, encryption passphrase and so on. | Yes |
callback | VMXCallback | The application must implement onSuccess and onFailure methods of VMXCallback interface. | 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 to 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 Code | Error Text |
106 | Claims token is unavailable. |
Example
VoltMXClient sdk = new VoltMXClient();
IVoltMXApplicationSync appSync = sdk.getOfflineObjects();
//Encrypt the device database using a passphrase
HashMap < String, object > options = new HashMap < String, object > ();
options.put("deviceDbEncryptionKey", "myencryptionpa$$phrase1");
appSync.setup(options, new VMXCallback() {
@Override
public void onSuccess(Object object) {
Log.d("Application Setup", "Application setup successful");
}
@Override
public void onFailure(Object error) {
OfflineObjectsException e = (OfflineObjectsException) error;
Log.e("Application Setup", "Application setup failed with error:" + e.getMessage() + "callstack: " + e.getStackTrace());
}
});
iOS (Objective C)
Signature
void <OfflineObjects> setup:(NSDictionary \*) options
onSuccess:(VMXSuccessCompletionHandler)onSuccess
onFailure:(VMXFailureCompletionHandler)onFailure;
Parameters
Parameter | Type | Description | Required |
options | NSDictionary<NSString*, id> | Setup options such as device database, encryption passphrase and so on. | Yes |
onSuccess | VMXSuccessCompletionHandler | The function is invoked on successful setup. | Yes |
onFailure | VMXFailureCompletionHandler | The function is invoked on setup failure with the cause of failure as an argument. | Yes |
Setup Options
Option | Type | Description | Required |
---|---|---|---|
deviceDbEncryptionKey | NSString | Encryption passphrase must be a string with at least six characters long. Refer Offline Objects Getting started Guide for more details. | 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 Code | Error Text |
106 | Claims token is unavailable. |
Example
VMXClient _ sdk = [VMXClient sharedClient];
OfflineObjects _ applicationSync = [sdk getOfflineObjects];
//Encrypt the device database using a passphrase
NSMutableDictionary < NSString _ , id > _ options = [NSMutableDictionary new];
[options setobject: @"myencryptionpa$$phrase1"
forKey: @"deviceDbEncryptionKey"
];
VMXSuccessCompletionHandler onSuccess = ^ void(id object) {
NSLog(@"Application setup successful");
};
VMXFailureCompletionHandler onFailure = ^ void(id object) {
NSLog(@"Application setup failed");
};
[applicationSync setup: options onSuccess: onSuccess
onFailure: onFailure
];