The Android SDK allows you to retrieve, create, and delete virtual folders. The following examples provide detailed steps that describe how to use supported methods and include code samples to help you get started with virtual folders.
createVirtualFolder
method allows you to create a virtual folder.
CloudAPI
class object with the application key, secret and the callback URL you obtained from the ThingSpace portal.CloudAPI#authorize()
.CloudAPI#createVirtualFolder
.Code Sample
try {
VirtualFolder virtualFolder = cloudAPI.createVirtualFolder((context, folderName);
} catch (CloudAPIException cloudAPIException) {
if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.USER_UNAUTHORIZED) {
Log.d("Create Virtual Folder", "User not authorized, please call CloudAPI#authorize()");
}
}
deleteVirtualFolder
method allows you to delte a virtual folder.
CloudAPI
class object with the application key, secret and the callback URL you obtained from the ThingSpace portal.CloudAPI#authorize()
.Code Sample
try {
boolean success = cloudAPI.deleteVirtualFolder((context, "folder name", false);
} catch (CloudAPIException cloudAPIException) {
if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.USER_UNAUTHORIZED) {
Log.d("Delete Virtual Folder", "User not authorized, please call CloudAPI#authorize()");
}
}
renameVirtualFolder
method allows you to rename a virtual folder.
CloudAPI
class object with the application key, secret and the callback URL you obtained from the ThingSpace portal.CloudAPI#authorize()
.Code Sample
try {
VirtualFolder virtualFolder = cloudAPI.renameVirtualFolder((context, "current folder name", "new folder name");
} catch (CloudAPIException cloudAPIException) {
if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.USER_UNAUTHORIZED) {
Log.d("Rename Virtual Folder", "User not authorized, please call CloudAPI#authorize()");
}
}
Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.