{"id":846,"date":"2020-03-23T09:46:48","date_gmt":"2020-03-23T09:46:48","guid":{"rendered":"https:\/\/dev.i-smartcloud.com\/?page_id=846"},"modified":"2020-03-24T17:24:27","modified_gmt":"2020-03-24T17:24:27","slug":"in-a-nutshell-android","status":"publish","type":"page","link":"https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/","title":{"rendered":"In a Nutshell"},"content":{"rendered":"\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>The Android Libary is written in JAVA and it contains all the code that a developer will need to connect to any of the supported Cloud Services, and to perform the supported Actions. In a series of articles we will describe this code and we will give example of its usage.<\/p>\n<\/div><\/div>\n\n\n\n<p>We use the Library by creating an instance of the <a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/rainbow-android\/\">Rainbow<\/a> class. In order to do this, however, we need first to initialize it by calling the static method init:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Rainbow.init(&lt;Context>);<\/code><\/pre>\n\n\n\n<p>You call this method only once in your app. The &lt;<strong>Context<\/strong>> can be the application context or the root activity. If your app has only one activity then it is OK to set it to the context of that activity. Otherwise, it should be the application context. Then, we get the instance of the Rainbow class by calling the getInstance() method:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Rainbow rainbow = Rainbow.getInstance();<\/code><\/pre>\n\n\n\n<p>We use that instance to get the list of available Cloud Services. If a user is already connected to a service, that instance will give us an object of that account. Once we have that object we can perform all  supported actions on that Cloud Account. But, before we get there it is important to describe the way that the Rainbow Library is designed.<\/p>\n\n\n\n<p>The code of the Rainbow SDK consists of five packages:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/api-android\/\">API<\/a><\/strong>: Code to connect to a Service and create an Account (ServiceItem)<\/li><li><strong><a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/service-android\">Service<\/a><\/strong>: Code that keeps track of the connected accounts (ServiceItems). It is also responsible for refreshing the Access Token<\/li><li><strong><a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/serviceitem-android\/\">ServiceItem<\/a><\/strong>: This object represents an account. It has all the variables that we need to connect to that account<\/li><li><strong><a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/cloud-manager-android\/\">Cloud Manager<\/a><\/strong>: This is where the magic takes place. With this code we can perform all supported actions to an account.<\/li><li><strong><a href=\"https:\/\/dev.i-smartcloud.com\/index.php\/transfer-android\/\">Transfer<\/a><\/strong>: Code that perform all kind of requests. <\/li><\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>All classes start with an &#8220;R&#8221;. Thus, we have the RIDriveAPI.h and RIDriveAPI.m files. These two files have the API code for the iDrive Cloud Service.<\/p><\/blockquote>\n\n\n\n<p>The name of each of these package is a link. Click on it to learn more about it. In the meantime, it is important to state here that  in order to create an instance of a Cloud Manager, we need an instance of a ServiceItem class. All ServiceItems are stored in an  instance of the Service class. The Service class, uses an instance of the API class to create an instance of a ServiceItem.<\/p>\n\n\n\n<p>Even though the above looks cumbersome and difficult to comprehend, it is extremely easy to use. As you can see in the Demo code, the Rainbow SDK takes care of all these steps, and you do not need to worry about anything.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Android Libary is written in JAVA and it contains all the code that a developer will need to connect to any of the supported Cloud Services, and to perform&#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-846","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>In a Nutshell - 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\/in-a-nutshell-android\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"In a Nutshell - Rainbow SDK\" \/>\n<meta property=\"og:description\" content=\"The Android Libary is written in JAVA and it contains all the code that a developer will need to connect to any of the supported Cloud Services, and to perform...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/\" \/>\n<meta property=\"og:site_name\" content=\"Rainbow SDK\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-24T17:24:27+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\/in-a-nutshell-android\/\",\"url\":\"https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/\",\"name\":\"In a Nutshell - Rainbow SDK\",\"isPartOf\":{\"@id\":\"https:\/\/dev.i-smartcloud.com\/#website\"},\"datePublished\":\"2020-03-23T09:46:48+00:00\",\"dateModified\":\"2020-03-24T17:24:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dev.i-smartcloud.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"In a Nutshell\"}]},{\"@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":"In a Nutshell - 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\/in-a-nutshell-android\/","og_locale":"en_US","og_type":"article","og_title":"In a Nutshell - Rainbow SDK","og_description":"The Android Libary is written in JAVA and it contains all the code that a developer will need to connect to any of the supported Cloud Services, and to perform...","og_url":"https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/","og_site_name":"Rainbow SDK","article_modified_time":"2020-03-24T17:24:27+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\/in-a-nutshell-android\/","url":"https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/","name":"In a Nutshell - Rainbow SDK","isPartOf":{"@id":"https:\/\/dev.i-smartcloud.com\/#website"},"datePublished":"2020-03-23T09:46:48+00:00","dateModified":"2020-03-24T17:24:27+00:00","breadcrumb":{"@id":"https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dev.i-smartcloud.com\/index.php\/in-a-nutshell-android\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dev.i-smartcloud.com\/"},{"@type":"ListItem","position":2,"name":"In a Nutshell"}]},{"@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\/846","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=846"}],"version-history":[{"count":18,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/846\/revisions"}],"predecessor-version":[{"id":949,"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/pages\/846\/revisions\/949"}],"wp:attachment":[{"href":"https:\/\/dev.i-smartcloud.com\/index.php\/wp-json\/wp\/v2\/media?parent=846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}