fluttercommunity / flutter_workmanager

A Flutter plugin which allows you to execute code in the background on Android and iOS.
825 stars 247 forks source link

🐞[Android production does not work on all phones] #552

Open JenteJan opened 2 months ago

JenteJan commented 2 months ago

Version

Technology Version
Workmanager version workmanager:
git:  
  url: https://github.com/absar/flutter_workmanager.git
  ref: 73cc539cd2f1b992b468e6c44f5d0a7919d7ffda   |

Describe the error Describe error I have implemented the newest version where ios runs immediately after going to bg. All works well on production ios, emulated ios and emulated android, but in production upwards of 80% of android users have a problem where the code does not appear to be running in the bg. I'm fairly certain there are no bugs that could be causing the background code to fail as they only occur on these production android devices. Im wondering if there is any AndroidManifest set up required not currently listed in the android set-up readme. Things I am doing in the background are: running native code, accesing the filesystem and fetching from internet. I am currently wondering if it has something to do with the newest version of android having more restrictions related to background running. I saw the docs for flutter background service at: https://pub.dev/packages/flutter_background_service which says to do additional set up for android 14+ where you request specific permissions for what bg service you make use of.

Output of flutter doctor -v

also not applicable as any example where i am in a testing environment does not produce the issue

zjnny commented 2 weeks ago

Android need to allow background service for your app(Power saving mode or other optimization about background servce will make workmanager not work)

tim-bacon-fivet commented 19 hours ago

I am also having this issue, we are currently in our closed test so have about 24 people using the app with most devices on Android 14, all work as expected except 1 and this 1 is on android 14 as well. I have asked the user to check about the power saving mode etc so will feedback once I hear back. I have triple checked my setup and all is in order.