Adding dropbox feature on my android app?
I have found the documentation available at https://www.dropbox.com/developers really not helpful! I even downloaded the sdk available at their site. My project requires the use of dropbox and enable my app to upload images onto a folder in the account. Can anyone help give me relevant info that cou开发者_如何学Gold be really handy for my project.
thanks in advance.
api = getAPI();
String state = Environment.getExternalStorageState();
File f=null;
if (Environment.MEDIA_MOUNTED.equals(state))
{
//SDcard is available
f=new File("/sdcard/test.txt");
if (!f.exists())
{
//File does not exists
try {
f.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
api.putFile("dropbox", "/Project", f);
Have you tried the Dropbox Android API sample project ? From there, once logged in you can api.putFile("dropbox", "/Project", file);
where /Project
is the folder in your dropbox account and the file
is the file you want to upload. That sample project can be modified to skip gui authentication and do it from code. If you need a full code sample please reply.
精彩评论