I have to create a multiple file uploads (3-7 photos), but this upload must be totally managed by the system, so that, even if the user closes the app, it should work until it completes uploading.
A little like Facebook, it upload a photo and if the app is killed: the progress also appears in the notification bar.
I currently use a class, I think FtpClient, which works well but if I close the app it stops. Everything is asynchronous but only for the app, not for the system.
How can I do that?
You should use Service
for this purpose. It will be running on background, and in it you can do all your upload/download work. You can look at this tutorial, and also read more about it from official documentation here and here.
You can just move all your logic from Activity
/Fragment
to Service
, and it will be do it in background, even if your app is closed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With