In my opinion, the Dropbox API is too complex for what you need. Itβs actually very easy to download a file from Dropbox.
The first step is to put the file you want to upload somewhere inside your Dropbox public folder.
Next, you want to right-click this file and select "copy public link". You can do this from the web interface or even right there in your sync folder. This will give you a unique URL to download the file.
Next, use this code:
String url="https://dl.dropboxusercontent.com/u/73386806/Prune%20Juice/Prune%20Juice.exe"; String filename="PruneJuice.exe"; try{ URL download=new URL(url); ReadableByteChannel rbc=Channels.newChannel(download.openStream()); FileOutputStream fileOut = new FileOutputStream(filename); fileOut.getChannel().transferFrom(rbc, 0, 1 << 24); fileOut.flush(); fileOut.close(); rbc.close(); }catch(Exception e){ e.printStackTrace(); }
Of course, change the url string value to your own download url and the file name value so that you want to save the file.
Now, if that fails, you may need to change the URL from https: // to http: //, but it will work anyway. Dropbox is awesome.
source share