{"id":923,"date":"2020-03-24T17:07:28","date_gmt":"2020-03-24T17:07:28","guid":{"rendered":"https:\/\/dev.i-smartcloud.com\/?page_id=923"},"modified":"2020-03-24T17:07:29","modified_gmt":"2020-03-24T17:07:29","slug":"transfer-android","status":"publish","type":"page","link":"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/","title":{"rendered":"Transfer"},"content":{"rendered":"\n<p>The <a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/cloud-manager-android\/\">Cloud Manager<\/a> classes have methods to list the contents of a folder, create a folder, delete a file or folder, and rename a file. In most cases this code suffices to develop a nice app, but if we want to transfer files (and folders), we need to use the Transfer class.<\/p>\n\n\n\n<p>This class is used from all Cloud Services, and it has only one method. We create an instance of this class by calling the constructor: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RTransfer rTransfer = new RTransfer(upPath, sManager, dManager,  fileLists);<\/code><\/pre>\n\n\n\n<p>where:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>upPath<\/strong>[String]: Is the <a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/item\/\">rItem.path<\/a> of the current folder. This is needed only when we want to transfer a file(s) into a folder. It can be empty string if we want to delete a file<\/li><li><strong>sManager<\/strong>[RManager]: The source RManager. This is the Cloud Service that the selected files will be copied from<\/li><li><strong>dManager<\/strong>[RManager]: The destination RManager. This is the Cloud Service that the selected files will be copied to<\/li><li><strong>fileLists<\/strong>[ArrayList&lt;RItem>]: The list of selected files.<\/li><\/ul>\n\n\n\n<p>The action that will be performed on a file is determined by the value of the <strong>actionToBePerformed<\/strong> property. Thus, we can use an instance of the RTransfer class to either delete a file or copy a file. It is OK if the fileLists variable contains files with different values for the <strong>actionToBePerformed<\/strong> property.<\/p>\n\n\n\n<p>Once we have the instance of the RTransfer class, we call the method start to transfer the files:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rTransfer.start();<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Callbacks<\/h2>\n\n\n\n<p>The RTransfer class uses two callbacks to inform us about the progress and when the process is completed:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>RTranferCallback<\/strong><ul><li><strong>isCompleted<\/strong>(String error)): This block is called when the process is completed. This means that all files that were in the fileLists array are transferred (deleted or copied). If there was a problem, the <strong>error<\/strong> variable inform us about the problem<\/li><\/ul><\/li><li><strong>RTransferProgressCallback<\/strong><ul><li><strong>onProgress<\/strong>(RTransferProgress progress): This block is called to inform us about the progress: Either of the file or of the entire process. The action property of the progress variable can take the following values:<\/li><\/ul><ul><li><strong>ttaFileName<\/strong>: The process to transfer a file is started. The property message of the progress variable is the name of the file<\/li><li><strong>ttaFileProgress<\/strong>: The progress of the file. The properties total and progress of the progress variable denote the bytes that are transferred and how many more are left to be transferred.<\/li><\/ul><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>In order to transfer files from one Cloud Manager to another we need an instance of the RTransfer class. Once we create that instance, we call the start method. Then RTransfer instance calls the <strong>downloadFile<\/strong> and <strong>uploadLocalFile<\/strong> methods on the Cloud Managers to transfer the selected files. The two callbacks of the RTransfer class will inform us about the progress and the status.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Cloud Manager classes have methods to list the contents of a folder, create a folder, delete a file or folder, and rename a file. In most cases this code&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-923","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Transfer - Rainbow SDK<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Transfer - Rainbow SDK\" \/>\n<meta property=\"og:description\" content=\"The Cloud Manager classes have methods to list the contents of a folder, create a folder, delete a file or folder, and rename a file. In most cases this code...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/\" \/>\n<meta property=\"og:site_name\" content=\"Rainbow SDK\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-24T17:07:29+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/\",\"url\":\"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/\",\"name\":\"Transfer - Rainbow SDK\",\"isPartOf\":{\"@id\":\"https:\/\/dev.i-smartcloud.com\/#website\"},\"datePublished\":\"2020-03-24T17:07:28+00:00\",\"dateModified\":\"2020-03-24T17:07:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dev.i-smartcloud.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Transfer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dev.i-smartcloud.com\/#website\",\"url\":\"https:\/\/dev.i-smartcloud.com\/\",\"name\":\"Rainbow SDK\",\"description\":\"The Rainbow Cloud Manager at your disposal\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dev.i-smartcloud.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Transfer - Rainbow SDK","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/","og_locale":"en_US","og_type":"article","og_title":"Transfer - Rainbow SDK","og_description":"The Cloud Manager classes have methods to list the contents of a folder, create a folder, delete a file or folder, and rename a file. In most cases this code...","og_url":"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/","og_site_name":"Rainbow SDK","article_modified_time":"2020-03-24T17:07:29+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/","url":"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/","name":"Transfer - Rainbow SDK","isPartOf":{"@id":"https:\/\/dev.i-smartcloud.com\/#website"},"datePublished":"2020-03-24T17:07:28+00:00","dateModified":"2020-03-24T17:07:29+00:00","breadcrumb":{"@id":"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dev.i-smartcloud.com\/"},{"@type":"ListItem","position":2,"name":"Transfer"}]},{"@type":"WebSite","@id":"https:\/\/dev.i-smartcloud.com\/#website","url":"https:\/\/dev.i-smartcloud.com\/","name":"Rainbow SDK","description":"The Rainbow Cloud Manager at your disposal","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dev.i-smartcloud.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/comments?post=923"}],"version-history":[{"count":7,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/923\/revisions"}],"predecessor-version":[{"id":930,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/923\/revisions\/930"}],"wp:attachment":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/media?parent=923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}