Skip to content

Doesn't call onDestroy on restart #12

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

Closed
darshansatra1 opened this issue Aug 8, 2021 · 6 comments
Closed

Doesn't call onDestroy on restart #12

darshansatra1 opened this issue Aug 8, 2021 · 6 comments

Comments

@darshansatra1
Copy link

I want to do some operations when the service stops. When the service is stopped in the app onDestroy function works properly. But when I restart my device the onDestroy function is not called. Am I missing something here? or is it just the way services are?

@Dev-hwang
Copy link
Owner

onDestroy only works when FlutterForegroundTask.stop() is called.

@darshansatra1
Copy link
Author

So when the onDestroy function code is running, can I start the service inside the function or it'll throw an error?

@Dev-hwang
Copy link
Owner

Restarting the service in the onDestroy func seems difficult. Try to avoid exceptions as much as possible. I'll check to see if there are any exceptions.

@darshansatra1
Copy link
Author

So we can start the service, right?

@Dev-hwang
Copy link
Owner

Upgraded plugins so that services can be restarted in case of unexpected problems. However, if the user forcibly terminates the service or the problem that continues to occur, it may not work because the event cannot be caught.

@darshansatra1
Copy link
Author

Thank you for the update

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

2 participants