Dev-hwang / flutter_foreground_task

This plugin is used to implement a foreground service on the Android platform.
https://pub.dev/packages/flutter_foreground_task
MIT License
140 stars 105 forks source link

Service could not gracefully restart #223

Open erisanolasheni opened 3 months ago

erisanolasheni commented 3 months ago

Hello, good day.

We use flutter foreground service, to calculate user steps in the background and display them in a sticky notification.

The problem we are trying to tackle now is app stops working in the background after some time but retains the sticky foreground notification, hanging at "x" last counted steps before the stop. We have gotten these reports from quite a number of our users. After several debugs, we think this happens when the operating system tries to free resources by restarting the foreground service.

Do you have any advice on how to make flutter foreground service restart gracefully whenever the Operating System forces it to do so and continue whatever activity from where it stopped without any seizure?

erisanolasheni commented 1 month ago

Hello, any update on this?

Dev-hwang commented 1 month ago

Please update to the latest version and check.

erisanolasheni commented 1 month ago

I will do, thank, really appreciate!

WingCH commented 1 month ago

I noticed that Foreground Service shut down after a day or so of stable operation. I have an idea to use Alarm Manager or Worker Manager to restart the frontend service, but I want to make sure that this is technically feasible or is there already a similar implementation? I'm not familiar with Android, @Dev-hwang Thanks for your help