cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Android app "Dropbox" want added downloaded files through Android Dropbox API

Android app "Dropbox" want added downloaded files through Android Dropbox API

kaftanati
Helpful | Level 6
Go to solution

I use Android API v2 for downloading folder files:

***
return mDbxClient.files().listFolder(params[0]);
***
***
OutputStream
outputStream = new FileOutputStream(file);
mDbxClient.files().download(metadata.getPathLower(), metadata.getRev())
.download(outputStream);
***

Files are downloading into standarr folder Downloads at device. Then my app move its (files exists at download folder < 1 sec).

 

But separate Android app Dropbox want add its again and show notification "Add into own Dropbox".

I use this function and can't disable it for all downloads.

 

How can I marked downloaded files for not showing such notify. Mark as unvisible or else?

Maybe I must mark this files before upload - metainfo "Dropboxed" for exlude dropbox parsing at future downloads?

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution
When you use that download method, the file data will be downloaded to whatever stream you supply. In this case, it's your "outputStream" variable, which is a "FileOutputStream" for "file". That being the case, to avoid this I recommend sending the file directly to the desired location, instead of using the Downloads folder as temporary storage.

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution
When you use that download method, the file data will be downloaded to whatever stream you supply. In this case, it's your "outputStream" variable, which is a "FileOutputStream" for "file". That being the case, to avoid this I recommend sending the file directly to the desired location, instead of using the Downloads folder as temporary storage.

kaftanati
Helpful | Level 6
Go to solution

Thanks!

 

My full code have hint for solutions:

File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
File file = new File(path, metadata.getName());
 
// Make sure the Downloads directory exists.
if (!path.exists()) {
   if (!path.mkdirs()) {
      mException = new RuntimeException("Unable to create directory: " + path);
   }
} else if (!path.isDirectory()) {
          mException = new IllegalStateException("Download path is not a directory: " + path);
          return null;
       }
 
OutputStream outputStream = new FileOutputStream(file);
 mDbxClient.files().download(metadata.getPathLower(), metadata.getRev()).download(outputStream);

I use example from GIT and miss file initiation, when find solving for problem.

Big thanks! You are awesome!

 

 

Need more support?