I have links of PDF files like "http://mywebsite/uploads/book1.pdf".
Now I want to download the file from that specific link and open in PDFviewer into my Android device.
I want to do it using retrofit
, I have tried many methods from stackoverflow but none worked for me, what is simplest code to download file from server using retrofit
if I have all the links available.
Thanks
Asked
Active
Viewed 1,518 times
0

Md. Sabbir Ahmed
- 850
- 8
- 22

Gej Zen
- 1
- 2
-
Retrofit is not usually used for downloading files, but rather for interacting with Web services. I recommend that you use a better tool for the job. OkHttp, for example, is fine for downloading arbitrary items like PDFs. You can even plug OkHttp into Retrofit, if you want a common configuration of how your Internet access works (e.g., proxy servers). – CommonsWare Mar 10 '19 at 18:02
-
ok sir @CommonsWare, and can you suggest any fastest library to download files from URL – Gej Zen Mar 10 '19 at 18:06
-
I recommend [OkHttp](https://github.com/square/okhttp), as I did in my original comment. – CommonsWare Mar 10 '19 at 18:09
-
See https://www.learn2crack.com/2016/05/downloading-file-using-retrofit.html. If you can use DownloadManager, see https://stackoverflow.com/questions/21477493/android-download-manager-completed. – CoolMind Jul 10 '19 at 14:16
-
Also https://stackoverflow.com/questions/32878478/how-to-download-file-in-android-using-retrofit-library. – CoolMind Jul 10 '19 at 14:53