I'm using Fuel in my Android code for downloading stuffs like PDF, Audio,Video and it works well, the problem arises when I wanna download big a file (50 MB and > file). I read about Fuel streamDestination but have no Idea how to solve this issue. Here is my code :
Fuel.download("https://$url")
.fileDestination { response, url ->
File(path, fileName)
}
.timeout(5000)
.response { request, response, result ->
result.fold(
success = {
progressDialog.dismissDialog()
listener.onDocDownloaded(fileName)
},
failure = {
progressDialog.dismissDialog()
}
}
I find solution thanks to Derk-Jan Karrenbeld. Here I just put working code :