Is there a way to get "Direct File Links" from Dropbox in android code without using the Dropbox API's?
I searched a lot on this but did not find a solution. Any responses will be appreciated.
get the file link for exemple https://www.dropbox.com/s/blablabla/test.pdf
replace www by dl
add ?dl=1 to the end
result of our example: https://dl.dropbox.com/s/blablabla/test.pdf?dl=1
Get the Dropbox link. Something like:
https://www.dropbox.com/s/abcdefg1234567/image.jpg?dl=0
Now replace the part after the ? with raw=1
https://www.dropbox.com/s/abcdefg1234567/image.jpg?raw=1
Paste in a browser and press Enter. That will redirect you to the actual file link. Something like:
https://dl.dropboxusercontent.com/content_link/aBcdEfGHiJ1234567890/file
Be careful to always use the raw=1 link though. The dl.dropboxusercontent.com that you are redirected to has a limited shelf life and will expire.
You can use the Chooser: https://www.dropbox.com/developers/dropins/chooser/android. It will present UI to the user to let them choose a file, and then it will give your app a URL you can use to download the file, or just the file content itself.
Get the share link of the file:
https://www.dropbox.com/s/abcdefg1234567/image.jpg?dl=0
At the end, replace dl=0 to dl=1:
https://www.dropbox.com/s/abcdefg1234567/image.jpg?dl=1
来源:https://stackoverflow.com/questions/17781766/getting-direct-file-links-from-dropbox