Warning: API v1 has been deprecated. Learn more.
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.
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.
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 DBRoulette.java files (look for
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.
Download the Android SDK linked above. You'll need to get the JAR files into Android Studio project and add them as libraries.
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:
<activity android:name="com.dropbox.client2.android.AuthActivity" android:launchMode="singleTask" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="orientation|keyboard"> <intent-filter> <!-- 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" /> </intent-filter> </activity>
Also make sure that your app has the internet permission by ensuring you have the following under the
<manifest> section of AndroidManifest.xml:
Now you're all set to start interacting with Dropbox.