I have a requirement to detect source of destroying service.
I am using intent and extra while calling
stopService(intent).
But where to catch this intent in Service class to act upon.
Already gone through android docs, nothing helpful found.
Any help is highly appreciated.
Now, I believe Mark Murphy when he said it isn't possible. As an alternative, you can register a BroadcastReceiver
in your Service
for stopping the service and then send broadcast to this receiver
from all over your app. Here, you can get all the information from the intent
sent to the receiver
. Within the receiver
, simply call stopSelf()
.