Cloudrail Tutorial
Cloudrail Useful Resources
Selected Reading
- Cloudrail - Coding
- Cloudrail - Setup
- Cloudrail - Social Login
- Cloudrail - IOS
- Cloudrail - Node.js
- Cloudrail - Java
- Cloudrail - Android
- Cloudrail - Overview
- Cloudrail - Home
Cloudrail Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Cloudrail - Android
Cloudrail - Android
This section gives an introduction on how to use CloudRail s Android SDK.
Setup
The easiest way to install is via Maven. If you are using Android Studio with Gradle, it suffices to add the following to your build.gradle file −
dependencies { compile com.cloudrail:cloudrail-si-android:2.8.1 }
Usage
The following example shows how to create a new folder and upload a file from an Android apppcation s assets to the newly created folder on any cloud storage provider.
java CloudRail.setAppKey("[CloudRail License Key]"); // CloudStorage cs = new Box(context, "[cpentIdentifier]", "[cpentSecret]"); // CloudStorage cs = new OneDrive(context, "[cpentIdentifier]", "[cpentSecret]"); // CloudStorage cs = new GoogleDrive(context, "[cpentIdentifier]", "[cpentSecret]"); CloudStorage cs = new Dropbox(context, "[cpentIdentifier]", "[cpentSecret]"); new Thread() { @Override pubpc void run() { cs.createFolder("/TestFolder"); // <--- InputStream stream = null; try { AssetManager assetManager = getAssets(); stream = assetManager.open("UserData.csv"); long size = assetManager.openFd("UserData.csv").getLength(); cs.upload("/TestFolder/Data.csv", stream, size, false); // <--- } catch (Exception e) { // TODO: handle error } finally { // TODO: close stream } } }.start();Advertisements