Install Core API SDKs

To make things as easy as possible, we have several platform SDKs you can import into your development environment to get up and running quickly. The SDKs contain platform-specific libraries that wrap the raw HTTP calls to the Dropbox API. They are designed to shorten the distance between your application and integrating Dropbox.

Android SDK

The necessary JAR files are in the "lib/" folder. To make things especially easy, there is also a sample application in the examples/DBRoulette/ folder included with the Android SDK.

If you haven't already, first follow the steps at Google's Android SDK installation guide. We should note that Google's de facto development environment is Android Studio, so we'll also be using Android Studio for these instructions.

Example app

DBRoulette is a very basic Android app that authenticates and then loads a random photo from your Dropbox's Photos folder. You can import the DBRoulette sample project into Android Studio by going to File → Import Project and selecting the path for DBRoulette. Make sure you've updated to the latest version of Android Developer Tools for Android Studio. Click through the dialog to Finish.

You'll need to edit the code to enter your app key and secret where indicated in the AndroidManifest.xml and files (look for CHANGE_ME).

Now try running the app to ensure it works. Feel free to use this Android Studio project as a template for your new project or read on to incorporate the SDK into your existing project by hand. If you do start up a new project, make sure to use a different app key and secret or uninstall DBRoulette from your device.

Adding to existing projects

Download the Android SDK linked above. You'll need to get the JAR files into Android Studio project and add them as libraries.

  1. Within Android Studio, switch to the "project view".
  2. From the libs directory in the downloaded SDK, drag the JAR files into your project's app/libs directory. (You'll need both dropbox-android-sdk-1.6.3.jar and json_simple-1.1.jar.)
  3. Right-click on all the JAR files you just added and choose "Add as library". Click "OK" on the dialog that appears.

You'll need to get your app key and secret from the options page of your App Console. Once you have the app keys, we'll need to enter the following snippet in your AndroidManifest.xml in order for the Dropbox SDK to finish the authentication process. Insert the following code under the <application> section, replacing INSERT_APP_KEY with your app key:

    <!-- Change this to be db- followed by your app key -->
    <data android:scheme="db-INSERT_APP_KEY" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.BROWSABLE"/>
    <category android:name="android.intent.category.DEFAULT" />

Also make sure that your app has the internet permission by ensuring you have the following under the <manifest> section of AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

Now you're all set to start interacting with Dropbox.