Foreground Service Restrictions
zfir opened this issue · 2 comments
Hello,
I am working on a solution with WorkManager for background uploading files. Can you tell me how you are dealing with the new foreground service restrictions?
I have seen your Docs:
Android 5.0 (API 21) to Android 12 (API 31) support. Beware you cannot start uploads while your app is the background on Android 12 due to recent Service limitations
My questions is:
- What problem you are facing with these restrictions?
- And how you are dealing with it?
Regards,
Zafir.
Hi!
This is how every upload task is started: https://github.com/gotev/android-upload-service/blob/master/uploadservice/src/main/java/net/gotev/uploadservice/extensions/ContextExtensions.kt#L25
Because of the limitations, the rule of thumb is to start uploads only when the app is in the foreground. Upload Service, from its inception, is targeted for user initiated uploads and not the right option to sync stuff in the background without the user noticing.
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.