Thinking Aloud
DropBox SDK and Android

So recently i worked on Dropbox SDK provided by the Dropbox team and tried to integrate it with an android app. Wouldn’t say it was easy but i got through it, and they the result is worth the time spent. :). I am writing this for anybody who wants to use dropbox api and i bothered by the wide spread info.

So here is what i did.

1) Get the idea of your app in place and get the code ready. (apart from DropBox integration part)

2) You need to register yourself on DropBox to be able to use their API`s.

3) You have to add an app there. This will give you an app key and an app secret. There is a small trick though. DropBox doesn’t allow you to spread you app without their permission. So with the Keys you just got, you can only use it for development. When you think your app is ready to be distributed, you have to pass it through them to be checked for their standards and best practices.

4) Assuming you have your app registered, you should download the DropBox SDK. This includes the libraries required to use DropBox and it also includes an example app.

5) Go through the example app. Its pretty decent. It doesn’t showcase all the functionality available though. You can find out what all you can do with the API here.

This is all you need to get started. After this point, its all you and your app.

How i did it comes next.

One problem with DropBox API is the authentication screen is to created by you. You ask the user for username and password. You pass them along to the respective authentication API. Its not a very good way to do it as the programmer can save the usernames and passwords on the go. Its not allowed though its not clean by any standards.

The API itself is damn simple and easy to use, with functions like “put(file, path)” to put a file in your DropBox and “get(file, path)” to get a file from your DropBox. The problem i faced was to keep a user logged in even as the activities change and not to ask the user to enter his credentials again. But i guess it was more of a lack of knowledge on my side then the problem with the SDK. Once i figured out that a session class can do the job, it was more or less about implementing the session class. Still i feel the ease to as we have in Facebook API is missing. There is a lot of scope to do better and i hope things are in the pipeline. Here are a few screen shots of how i solved my problem of using DropBox for saving a single or multiple photos.

There is still work to be done on the app. But as they say, its the Journey that matters the most, result is just a byproduct.