Getting Started with the Dropbox Core API for Android

Dropbox has several APIs listed on their developer portal, and that can be a little confusing at first. Take your time to poke through each one, and see which one works best for your own specific needs.

I wanted to learn how to integrate Dropbox functionality into my Android app, so I did a Google search for "dropbox android sdk". The first result led me to the download page for the Android SDK for the Core API, and at that point not knowing that there were multiple SDKs for the different APIs, I decided to start with that.

This article will focus specifically on getting the starter project for the Core API set up in Eclipse/ADT. You can also watch the YouTube video I made.

1. Download the Android SDK for Core API. Click on the download link on the download page.
 

2. Unzip the downloaded SDK, then import the sample project.

3. If you try running the project now, you see this:

So go to the site and register your app to obtain the app key and app secret. Just go to developers.dropbox.com and click on "App Console" on the left hand navigation pane.

Sign into your Dropbox account to continue, and you'll see this: 

Click on the Create app button on the top left corner of the page as shown in the screenshot above. You'll get a form and you'll have to also verify your email address when you create the app if you haven't done so already. Select Dropbox API app as shown below:

Fill out the rest of the form:

As you see in the screenshot above, you can't use the word "Dropbox" in the app name - the branding guidelines tell you that you can't do that. Once you successfully create an app, you get a dashboard similar to the one below. Find the app key and app secret, and copy and paste it into the right file in Eclipse.

4. Next, try running the project again. You see this:

It means we also need to change the manifest file of the app to include the app key. As you can see in the following screenshot, you replace "CHANGE_ME" with your app key in the line highlighted:

5. Run the project now. It should work! You'll see this:

Clicking on "Link with Dropbox" as seen in the screenshot above would prompt you (and anyone who uses this app) to sign in with Dropbox:

After going through the sign-in flow and granting permission for the app to access the files and folders in your Dropbox, the app brings you back to the main view. You can click on "New Photo" to upload a photo, and see a progress bar of it uploading. Clicking on "Roulette" will display a photo that was uploaded onto Dropbox.

That's it! It was super painless and easy to set up the starter project for the Dropbox Core API Android SDK.