Shatazone Shatazone - 3 years ago 85
Android Question

Handle force close?

Is there a way to notify an activity/service of a force-close request right before it gets killed?

I mean when the user hits the force close button in

Menu > Settings > Applications > Manage applications > app name > Force Close

Answer Source

I think the ActivityManager just kills the hosting process, so you may not be able to get any event/message/warning. To check you could create an app that has a single Activity that lets you know if onDestroy is called, and further if isFinishing is invoked.

The path to Menu > Settings > Applications > Manage applications > app name > Force Close in the source, in case it helps, is:





Once it gets the native level it hands off to a Service that does the dirty work. Again, I would guess it just stops the process, but that's a guess, and I don't know off the top of my head where the other side of the native interface is in the source to check (though it's there somewhere if you poke around and want to know for sure).

Also you might want to add why you want this information to your question, there might be a different/better angle to getting what you want accomplished, depending on that.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download