OneDrive Android SDK – How to integrate the OneDrive API on Android
This tutorial describes how to integrate Microsoft’s OneDrive API into an Android application. We will use the CloudRail SDK which is even easier to use than Microsoft’s official OneDrive Android SDK and also allows to add more cloud storage providers like Dropbox and Google Drive in no time.
About OneDrive and its Android SDK
OneDrive, formerly known as SkyDrive, is Microsoft’s cloud storage solution. It is similar to Dropbox or Google Drive. 5GB of storage are offered for free and its deep integration into products like Microsoft Windows 10 or the Microsoft Office package make it an important addition to all kinds of applications. Microsoft offers a REST API as well as SDKs for different platforms, Android among them. Unfortunately, the official OneDrive Android SDK is complicated to use and has an interface that is different from the SDKs of other cloud storage providers. CloudRail is a better alternative.
The CloudRail Android SDK
CloudRail is an API integration solution that unifies APIs from all kinds of cloud services. It comes with universal SDKs for different platforms, including Android. You can use one SDK to integrate Box, Google Drive, Dropbox, Egnyte and of course OneDrive. Even more services from different categories like social networks, payment and more are available, but we will focus on cloud storage and OneDrive in particular. As a plus, CloudRail takes care of API maintenance. Remember when Dropbox announced that they will shut down their v1 API? That sure is trouble for all developers not using CloudRail. They have to upgrade to v2 which comes with a new SDK with different functions. CloudRail users on the other hand can lean back, all they need to do is update the library, the API towards their Android applications stays consistent.
Let’s plunge into the code
Before you can start implementing you have to sign up for developer accounts with CloudRail and Microsoft.
- Sign-up for a CloudRail account (free) to download the Android SDK
- Sign-up for a Microsoft Developer Account & get your clientIdentifier and clientSecret
- Consult extensive documentation if necessary
Now to the actual integration, have a look at the following code sample which shows how to access OneDrive via the Android SDK. Take particular note of the first few lines which are commented out. They show how easy it is to implement more than just OneDrive with CloudRail.
Besides Android, CloudRail is also available for platforms like Node.js, Swift, Objective-C and Java. Learn more at cloudrail.com