I have a task to upload photos (can be one photo or can be 50 or 100 photos) to the cloud and once uploaded photos are done display a notification. The API supports one photo at a time and I need to update the UI with the uploaded photo if it was successful or not.
Obviously what comes to my mind is to create a service but since Android now suggests using WorkManager to do all our foreground/background work, I started investigating Workers and WorkManager.
I would like to hear the community's opinion regarding the following:
Knowing the requirements mentioned above, would you rather go with
Create a single long running worker that does all the uploads sequentially and then create a notification once they are done, or
Have one worker that all it does is upload a single photo and create for every image upload a OneTimeWorkRequest and the notification as a separate worker.
Example:
workManager .beginUniqueWork(workUniqueId, ExistingWorkPolicy.REPLACE, uniqueUploadPhotoWorkRequestList) .then(notificationWorkRequest) .enqueue()