As far as I understand from this question and the official reference and guide, only onDestroy()
is called, when my app gets removed from the recent apps list.
In my app I have a single activity which starts a service to play music. In the activity´s onDestroy()
, the service is not even mentioned, but still I get an illegal argument exception thrown when my app is removed from the list, pointing to said service:
Parameter specified as non-null is null:
method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter intent
at com.example.soulfetch2.BordunService.onStartCommand(BordunService.kt)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3468)`
As in onDestroy()
, the service is not even mentioned, there must be something else trying to access the service that is not existing anymore. Any idea what it could be?
If onPause()
and/or onStop()
also are called, is there a way to distinguish the removal case from the other cases in which those two are called?