-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Description
Use case
I've a process in the background that is triggered by android_alarm_manager periodically every 10mins , this process might take a lot of time depending of the network connection, so i have a variable stored with "shared_preferences" called isWorking
that is set to true when it starts and supposed to set to false when it finishes, so if another background process is triggered and is still working will be skipped
the issue is that sometimes, the user could clean all the apps for the task manager and suddenly kill the background process keeping the isWorking
as true forever, even if not working anymore
Proposal
Would be great if is there any way to get an event on the background process when is about to be killed, probably related? https://stackoverflow.com/a/33078782/583718
or even better, a way to check the process status by id, since i can get the Insolate Id , i could store it also in "shared_preferences" and check the status in the next process, if the id is still alive, i can skip it until the next schedule , i've tried this but was never triggered, https://api.flutter.dev/flutter/dart-isolate/Isolate/addOnExitListener.html