VMXFoundry.OfflineObjects.drop
Offline Objects drop function deletes the database schema along with all its data. Success or failure is reported through callbacks provided to the drop API.
Volt MX Iris (JavaScript)
Signature
VMXFoundry.OfflineObjects.drop(options, successCallback, failureCallback)
Parameters
| Parameter | Type | Description | Required |
| options | JSON | Drop options such as device database, encryption passphrase and so on. | Yes |
| successCallback | Function | The function is invoked on success. | Yes |
| failureCallback | Function | The function is invoked on an error with the cause of failure as an argument. | Yes |
| Option |
Type |
Description |
Required |
| deviceDbEncryptionKey |
String |
Encryption passphrase must be a string of six characters long. For further information, refer Offline Objects Getting Started Guide.
Note: Not applicable for Mobile Web and Desktop Web channels. |
No |
Return Type
void
Example
function successCallback() {
voltmx.print("Application drop success")
}
function failureCallback(error) {
voltmx.print("Application drop failed with error" + error.code);
}
//Decrypt the device database, if encrypted
var options = {
"deviceDbEncryptionKey": "myencryptionpa$$phrase1"
};
VMXFoundry.OfflineObjects.drop(options, successCallback, failureCallback);
Android (Java)
Signature
void <OfflineObjects>.drop(final HashMap<String, object>options, final VMXCallback callback)
Parameters
| Parameter | Type | Description | Required |
| options | HashMap<String, object> | Drop option such as device database, encryption key and so on. | Yes |
| callback | VMXCallback | Application implements onSuccess and onFailure methods of VMXCallback interface. | Yes |
Drop Options
| Option |
Type |
Description |
Required |
| deviceDbEncryptionKey |
String |
Encryption passphrase must be a string with at least six characters long. Refer Offline Objects Getting Started Guide for more details. |
No |
Return Type
void
Example
VoltMXClient sdk = new VoltMXClient();
IVoltMXApplicationSync appSync = sdk.getOfflineObjects();
//Decrypt the device database if encrypted
HashMap < String, object > options = new HashMap < String, object > ();
options.put("deviceDbEncryptionKey", "myencryptionpa$$phrase1");
appSync.drop(options, new VMXCallback() {
@Override
public void onSuccess(Object object) {
Log.d("Application DROP", "Application drop Successful");
}
@Override
public void onFailure(Object error) {
OfflineObjectsException e = (OfflineObjectsException) error;
Log.e("Application DROP", "Application drop failed with error:" + e.getMessage());
}
});
iOS (Objective C)
Signature
void <OfflineObjects> drop:(NSDictionary *) options onSuccess: VMXSuccessCompletionHandler)OnSuccess
onFailure:(VMXFailureCompletionHandler)onFailure
Parameters
| Parameter | Type | Description | Required |
| options | NSDictionary<NSString*, id> | Drop options such as device database, encryption passphrase and so on. | Yes |
| onSuccess | VMXSuccessCompletionHandler | The function is invoked on success. | Yes |
| onFailure | VMXFailureCompletionHandler | The function is invoked on an error 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. For more details, refer Offline Objects Getting Started Guide. |
No |
Return Type
void
Example
VMXClient _ sdk = [VMXClient sharedClient];
OfflineObjects _ applicationSync = [sdk getOfflineObjects];
//Decrypt the device database if encrypted
NSMutableDictionary < NSString _ , id > _ Options = [NSMutableDictionary new];
[options setObject: @"myencryptionpa$$phrase1"
forKey: @"deviceDbEncryptionKey"
];
VMXSuccessCompletionHandler onSuccess = ^ void(id object) {
NSLog(@"Application drop successful");
};
VMXFailureCompletionHandler onFailure = ^ void(id object) {
NSLog(@"Application drop failed");
};
[applicationSync drop: options
onSuccess: onSuccess
onFailure: onFailure
];