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
7 years agoExplorer | Level 4
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 {
}
}
}
- kmsbsExplorer | Level 4what is the path pattern :
mDbxClient.files().download("https://www.dropbox.com/home/Apps/AndroidDbAppStorage/"+name)
.download(outputStream);- Greg-DBDropbox Staff
The path values you supply to the API should be paths relative to the root of the Dropbox account (or relative to the app folder root, if you're using an app with the app folder permission), not Dropbox web site URLs as you have here.
So, for example, to upload a file "myfile.txt" to your root, you would use "/myfile.txt". Or, to upload it into a subfolder "Documents", you would use "/Documents/myfile.txt".
You can also get the correct path values from Metadata.getPathLower, if/when you get the metadata for existing files elsewhere on the API:
https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/files/Metadata.html#getPathLower--- kmsbsExplorer | Level 4here my path :
/Apps/AndroidDbAppStorage/"+name
it return empty file.
About Discuss Dropbox Developer & API
Make connections with other developers
795 PostsLatest Activity: 9 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!