mudit
mudit

Reputation: 25534

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 able 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.

Upvotes: 0

Views: 5428

Answers (2)

zennni
zennni

Reputation: 1737

This GitHub library could help : https://github.com/gotev/android-upload-service 2.3K stars Apr 2020

enter image description here

" -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

...

"

Upvotes: 1

ElDog
ElDog

Reputation: 1437

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); 

Upvotes: 1

Related Questions