Call downloadFile
to download a file from a user’s Personal Cloud Storage account. File is downloaded at the downloadPath location.
CloudAPI
class object with the application key, secret and the callback URL you obtained from the ThingSpace portal.CloudAPI#authorize()
.getFullview
or search
method to obtain information on files stored in the user’s Personal Cloud Storage.Code Sample
FullviewItem fullviewItem = (FullviewItem) itemList.getItem(position); File sdcard = Environment.getExternalStorageDirectory(); File folder = new File(sdcard.getAbsoluteFile(), "DemoApp"); folder.mkdir(); try { boolean downloadSuccess = cloudAPI.downloadFile(context, fullviewItem.getParentPath(), fullviewItem.getName(), folder.getAbsolutePath()); Log.d("Download", downloadSuccess ? "File downloaded": "File download failed"); } catch (CloudAPIException cloudAPIException) { if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.USER_UNAUTHORIZED) { Log.d("Download", "User not authorized, please call CloudAPI#authorize()"); } }
Call uploadFile
method to upload files to a folder in a user’s Personal Cloud Storage account.
NOTE: You cannot perform uploadFile
operatioin on a virtual folder.
CloudAPI
class object with the application key, secret and the callback URL you obtained from the ThingSpace portal.CloudAPI#authorize()
.getMetadata
method to obtain paths of the folders stored in the user’s Personal Cloud Storage. Use the path of an existing folder as the destinationFolderPath
to upload the file to an existing folder. If a folder in the destination folder does not exist, a call to uploadFile
API will create that folder.Code Sample
try { boolean uploadSuccess = cloudAPI.uploadFile(context, destinationFolderPath, fileName, filePath); Log.d ("Upload", uploadSuccess ? "File uploaded" : "File upload failed"); } catch (CloudAPIException cloudAPIException) { if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.USER_UNAUTHORIZED) { Log.d("Upload", "User not authorized, please call CloudAPI#authorize()"); } else if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.ERROR_FILE_ALREADY_EXIST) { Log.d("Upload", "File already exist"); } }
Call fullview
to retrieve all files and folders stored in a user’s Personal Cloud Storage account.
CloudAPI
class object with the application key, secret and the callback URL you obtained from the ThingSpace portal.CloudAPI#authorize()
.Code Sample
try { ItemList<FullviewItem> itemListFullview = cloudAPI.fullview(context); for (int i=0; i<itemListFullview.getCount(); i++) { FullviewItem fullviewItem = itemListFullview.getItem(i); Log.d("Fullview", "Name: " + fullviewItem.getName()); } } catch (CloudAPIException cloudAPIException) { if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.USER_UNAUTHORIZED) { Log.d("Fullview", "User not authorized, please call CloudAPI#authorize()"); } }
Call getThumbnailToStream
to retrieve thumbnails for files stored in a user’s Personal Cloud Storage account.
See Also:
ThumbnailSize
for information on supported thumbnail sizes.CloudAPI
class object with the application key, secret and the callback URL you obtained from the ThingSpace portal.CloudAPI#authorize()
.Code Sample
try { FileOutputStream fileOutputStream = new FileOutputStream("cache location"); cloudAPI.getThumbnailToStream(context, data, fileOutputStream); Bitmap bitmap = BitmapFactory.decodeFileDescriptor(fileOutputStream.getFD()); } catch (CloudAPIException cloudAPIException) { if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.USER_UNAUTHORIZED) { Log.d("Get Thumbnail", "User not authorized, please call CloudAPI#authorize()"); } }
Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.