I wanted to know if my app is killed when it is in background. I am using android nougat device to test. But when I killed my app by swiping, onTaskRemoved() of my service is not calling.
Is there any way to know when the user kills the app before onDestroy() of the activity called?
onTaskRemoved()
method is only called when you have set android:stopWithTask="false"
in your manifest file.
So do check your manifest file because whenever the service is killed by the system then onTaskRemoved()
is always called.