ZouhirBensm commented on issue #364: URL: https://github.com/apache/cordova-plugin-file/issues/364#issuecomment-2822131138
I found the solution. I still need to decipher what exactly is going on. These are my first impressions. [Cordova](https://earnanswers.com/blog-element/how-to-http-api-requests-from-android-to-locahost) is able to download big (+ ~300 MB) files from a server. To do so, what worked for me was editing the API calls in tool/lib/package/... I randomly came across this article dated 18th October 2017 that shows how to make API calls the right way, in order to retrieve a file IMO. [https://cordova.apache.org/blog/2017/10/18/from-filetransfer-to-xhr2.html](https://cordova.apache.org/blog/2017/10/18/from-filetransfer-to-xhr2.html) You will find an implementation example on the webpage. DM me on Github if you want the exact implementation I used to do so. I essentially was able to implement a version to download an MP3 file from a server in Blob format. I identified that the response had a valid blob format of the MP3 file by inspecting it through code and logs. After this add-on, the Cordova app was crashing. Get this! I realized the crash was not from the API call, but from the save file process that saves "large" files onto the Android file system. The saving process kept making the [Cordova Android app](https://earnanswers.com/blog-element/download-and-save-large-file-in-android-cordova-app) crash. So I am still not sure if it was my previous API call method or both it and the save process that make the Cordova Android app crash. (I had to make a bunch of detailed logs provided in real time from the Android OS level to identify that the save operation was making the app crash. Again, you can DM me to know the exact error if you want.) The "hack" to fix this is to essentially save the file in chunks. (DM for more code details) The diagnosis and solution are too long to explain here in detail, but the gist of the solution is here. I find it curious that Cordova doesn't have an easy-to-find, simple built-in lib/tool/api to save large files? I also find it curious that Cordova doesn't have easy-to-find documentation showing the best standard way to download and save a large file? I'll be posting a detailed solution for downloading and saving large files in Cordova Android apps on Stack Overflow. Anyhow, I thought I would share my solution for others that are struggling and wondering why their app is silently crashing when downloading a large file on an Android Cordova app. Thanks. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org