Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service could not gracefully restart #223

Closed
erisanolasheni opened this issue May 26, 2024 · 5 comments
Closed

Service could not gracefully restart #223

erisanolasheni opened this issue May 26, 2024 · 5 comments

Comments

@erisanolasheni
Copy link

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
Copy link
Author

Hello, any update on this?

Dev-hwang added a commit that referenced this issue Jul 18, 2024
@Dev-hwang
Copy link
Owner

Please update to the latest version and check.

@erisanolasheni
Copy link
Author

I will do, thank, really appreciate!

@WingCH
Copy link

WingCH commented Aug 3, 2024

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

@WingCH
Copy link

WingCH commented Sep 10, 2024

I discovered that this library has already implemented the use of Alarm Manager to restart the service:

https://github.com/Dev-hwang/flutter_foreground_task/blob/master/android/src/main/kotlin/com/pravera/flutter_foreground_task/service/RestartReceiver.kt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants