Upload large files on the web server on android
I want to upload files on a web server in my android app.Currently i am ab开发者_Python百科le to upload files around 5mb from the device but more than this gives a outofmemory exception and also makes app very unstable.
i am looking for a method using which we can upload the data in the app background plus of bigger size. Any tutorials/ code is highly appreciated.
thanks in advance.
You probably want to check out this post from Fedor.
The main point is that you need to set on chunking.
e.g.
connection.setChunkedStreamingMode(chunkSize);
This GitHub library could help : https://github.com/gotev/android-upload-service 2.3K stars Apr 2020
" -Easily upload files (Multipart/Binary/FTP out of the box) in the background with progress indication notification
-upload files to a server with FTP, HTTP multipart/form-data or binary requests
-handle multiple concurrent uploads in the background, even if the device is idle (Doze mode)
-automatically retry failed uploads, with a configurable exponential backoff possibility to automatically delete uploaded files when the upload is successful
Apps and libraries powered by this library-
-JIRA Cloud
-Quora
...
"
精彩评论