How can I detect app kill on Android 8.0 Oreo API 26 and after

Viewed 1779
1 Answers

You could use same solutions you linked, but starting from Oreo a SERVICE should be started as FOREGROUND_SERVICE or it will be killed withing 5 seconds from the System. So you can reuse 90% of previous code but you need to do changes according to new Oreo requirements.

However if the App is killed from "Android Settings --> Apps" page by selecting the "Terminate" button, even all Background Services are killed in the same time, so if this case occurs those methods will not work anymore.

Related