Monday, May 2, 2011

Plugging in the DropBox API to android application

DropBox, as we all know is an online storage and it provides file browsing, synchronization, backup and share. They have support for mobile App development.
Their SDK encapsulate, the RESTful calls that they make over HTTP to interact with DropBox service. I was expecting a good online documentation, which would have made the developer's work easier, but sadly enough there was none, at least at the time of writing this post. So, I downloaded their sample application in Java (there were Python and Ruby versions as well). What helped me in understanding the usage, was the JUnit Testcases in the client code that is available for download. The sample app is only instantiating the client API (the one that makes the RESTful calls) and listing the contents of a directory. But if one goes through the JUnit Test cases, one can clearly understand the usages of the API.
Another important thing that I would like to mention here is that, while the DropBox api gives all meta data related information of a directory (account name, available storage, directory children etc.), if one wants to perform copy,move,delete operations on the user file System on the DropBox, one must instantiate the DropBox client:
Dropboxclient mClient = new DropboxClient(Map configMap, Authenticator auth);
IMHO, this could have been avoided if the DropBox guys provided CRUD implementation in the DropboxAPI itself.
DropboxAPI mApi = new DropboxAPI();
The DropboxAPI class already instantiates Dropboxclient. But then why to force the developers to instantiate it again just to get access to the CRUD operations?
But I guess it is still in evolving stage, as they have admitted their code is well tested in Python, Java and Ruby...in that order. :)
All in all, a very useful API if one wants to integrate the DropBox service for their Android app.

No comments:

Post a Comment