You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

kmsbs's avatar
kmsbs
Explorer | Level 4
7 years ago

what should be a file download path

what is the correct download path : 

 mDbxClient.files().download(Path =?);
 mDbxClient.files().download("https://www.dropbox.com/home/Apps/AndroidDbAppStorage")
.download(outputStream);

here its my code :

public  class DownloadFileTask extends AsyncTask<FileMetadata, Void, File> {

private final Context mContext;
private final DbxClientV2 mDbxClient;
String name,path;
private File file;
DownloadFileTask(Context context, DbxClientV2 dbxClient, String path,String name) {
mContext = context;
mDbxClient = dbxClient;
this.path = path;
this.name=name;
}

@Override
protected File doInBackground(FileMetadata... params) {
try {
file=new File(path+name);
// Download the file.
OutputStream outputStream = new FileOutputStream(file);
mDbxClient.files().download("https://www.dropbox.com/home/Apps/AndroidDbAppStorage")
.download(outputStream);

// Tell android about the file
Intent intent = new Intent(mContext, LoginActivity.class);
mContext.startActivity(intent);

return file;
} catch (DbxException | IOException e) {
}

return null;
}

@Override
protected void onPostExecute(File result) {
super.onPostExecute(result);
if (result.length()!=0) {
Toast.makeText(mContext, "File downloaded", Toast.LENGTH_SHORT).show();
} else {

}
}
}