gotev / android-upload-service

Easily upload files (Multipart/Binary/FTP out of the box) in the background with progress notification. Support for persistent upload requests, customizations and custom plugins.
Apache License 2.0
2.82k stars 693 forks source link

WorkManager brainstorming and future of this library #610

Open gotev opened 2 years ago

gotev commented 2 years ago

From Android 8 onwards, Google started to push back on Android Services. With the release of Android 12, services are no longer considerable "first class citizens", as clearly Google is pushing stuff to be made with WorkManager now and it does make sense. You currently cannot start uploads while the app is the background on Android 12.

Current internal architecture revolves around the now "old school" android way of doing stuff:

With WorkManager it will be completely different. Also the library name as it is now won't be representative anymore.

This issue is meant to be a brainstorming room about the future of this library going forward. It's clear that the Service architecture is coming to an end.

I'm also wondering if it does make sense to still maintain the lib, as moving to WorkManager will mean a total rewrite from the ground up, to be "just" a bunch of job implementations to be used with WorkManager APIs, changing the face of this library and its usage completely.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

JessHolle commented 1 month ago

One note on an issue raised on https://github.com/gotev/android-upload-service/issues/657 regarding ForegroundServiceStartNotAllowedException occurring.

One should apply the workaround for this issue noted in https://stackoverflow.com/questions/70711950/android-12-foregroundservicestartnotallowedexception-while-in-foreground if this has not already been done.

See https://issuetracker.google.com/issues/229000935#comment34

JessHolle commented 1 month ago

I believe there is a point to this library continuing (or perhaps a renamed version thereof) to take the work out of using WorkManager for upload tasks and (hopefully) improving on the current state of affairs by reloading app code only when conditions are met for the upload (e.g. network availability).

gotev commented 1 month ago

One note on an issue raised on #657 regarding ForegroundServiceStartNotAllowedException occurring.

One should apply the workaround for this issue noted in https://stackoverflow.com/questions/70711950/android-12-foregroundservicestartnotallowedexception-while-in-foreground if this has not already been done.

See https://issuetracker.google.com/issues/229000935#comment34

See https://github.com/gotev/android-upload-service/blob/447a839a53898d1759c35afa8efef8a6ab9be212/uploadservice/src/main/java/net/gotev/uploadservice/UploadService.kt#L222

gotev commented 1 month ago

I believe there is a point to this library continuing (or perhaps a renamed version thereof) to take the work out of using WorkManager for upload tasks and (hopefully) improving on the current state of affairs by reloading app code only when conditions are met for the upload (e.g. network availability).

So your point of view is maintaining the library public API and use WorkManager internally instead of the upload service, right?

JessHolle commented 1 month ago

I believe there is a point to this library continuing (or perhaps a renamed version thereof) to take the work out of using WorkManager for upload tasks and (hopefully) improving on the current state of affairs by reloading app code only when conditions are met for the upload (e.g. network availability).

So your point of view is maintaining the library public API and use WorkManager internally instead of the upload service, right?

Yes. Maintain an easy-to-use but flexible external API but internally use WorkManager to get Google to stop pestering and hopefully improve behavior from a user perspective by letting the OS kill the app/service process when resources are tight and only start it up again when conditions are right for the upload work. That seems like the underlying user benefit of the WorkManager that Google is pushing -- only loading/keeping app code in memory only when actually helpful.

gotev commented 1 month ago

That sounds good on paper. To actually make it, it's necessary to first and foremost be proficient at using WorkManager and know its lifecycle and concepts, then those have to be put in the context of the actual internal architecture of the library and its internal lifecycle, mapping all the needed changes and checking if that's going to cause changes for actual users, eliminating classes and code which will not be needed anymore. After the plan is made, actual implementation could start.

For the foreseeable future I won't have the needed time to do this work, but I'll leave this thread open for everyone who wants to help or try an implementation.