The Android SDK allows you to retrieve, create, and delete tags. The following examples provide detailed steps that describe how to use supported methods and include code samples to help you get started with tags.
CloudAPI
class object with the application key, secret and the callback URL you obtained from the ThingSpace portal.CloudAPI#authorize()
.Code Sample
try { ItemList<Photo> itemListPhotos = cloudAPI.getPhotos(context, SortType.VERSION_CREATED.setOrder(SortType.SortOrder.DESC)); Photo photo = itemListPhotos.getItem(0); String tags = "New Tag"; String newTags = cloudAPI.setTags(context, photo.getUri(), tags); Log.d("Set Tags", "Tags: " + newTags); } catch (CloudAPIException cloudAPIException) { if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.USER_UNAUTHORIZED) { Log.d("Set Tags", "User not authorized, please call CloudAPI#authorize()"); } }
deleteTags method allows you to delte tags for a file or folder.
CloudAPI
class object with the application key, secret and the callback URL you obtained from the ThingSpace portal.CloudAPI#authorize()
.Code Sample
try { ItemList<Photo> itemListPhotos = cloudAPI.getPhotos(context, SortType.VERSION_CREATED.setOrder(SortType.SortOrder.DESC)); Photo photo = itemListPhotos.getItem(0); cloudAPI.deleteTags(context, photo.getUri()); } catch (CloudAPIException cloudAPIException) { if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.USER_UNAUTHORIZED) { Log.d("Delete Tags", "User not authorized, please call CloudAPI#authorize()"); } }
getTags method allows you to retrieve tags for a file or folder.
CloudAPI
class object with the application key, secret and the callback URL you obtained from the ThingSpace portal.CloudAPI#authorize()
.Code Sample
try { ItemList<Photo> itemListPhotos = cloudAPI.getPhotos(context, SortType.VERSION_CREATED.setOrder(SortType.SortOrder.DESC)); Photo photo = itemListPhotos.getItem(0); String path = photo.getParentPath() + "/" + photo.getName(); String tags = cloudAPI.getTags(context, path); Log.d("Get Tags", "Tags: " + tags); } catch (CloudAPIException cloudAPIException) { if (cloudAPIException.getCode() == CloudAPIException.ErrorCode.USER_UNAUTHORIZED) { Log.d("Get Tags", "User not authorized, please call CloudAPI#authorize()"); } }
Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.