3

I need to detect if the user force stop my service (from application manager). In onDestroy() I need to implement different function when service stopped by the user("force stop") or by the system(low memory)/reboot.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Andy
  • 301
  • 1
  • 11
  • If the system force stops a service due to low memory `onDestroy()` is never called. I suspect the same happens when a user clicks "force stop" button which is (not 100% sure - Settings app sources should be browsed) equivalent to `am force-stop` command. Probably checking if your service is alive would be the right direction. Lots of posts on that can be found on SO. – Onik Dec 27 '15 at 20:35
  • Thanx, I still need to distinguish between "force stop" by the user or phone shutdown. If isfinishing() method happens in both cases, it means that the only method I have is to register a shutdownreceiver to detect shutdown? – Andy Dec 28 '15 at 05:50

0 Answers0