Search code examples
androidiosuno-platform

How to detect that an app is shutdown vs. suspended


How could I detect that an app really is shutdown/killed vs. being suspended (.Suspending/.Suspended)?

I needed to trigger some code only as the app ultimately is killed (if ever).

Thanks in advance


Solution

  • The Application.Suspending event (e.g. on iOS) is raised when the application is being suspended.

    You generally cannot determine reliably if the app is being killed, and can only do something when the app restarts, during the OnLaunched method. You should assume that your app may be terminated once Suspending has been invoked.