title: Shutdown Events in Android
body: <p>Is it possible to intercept a phone shutdown event or perhaps use a different hack around this? I have an always running service that's part of a non-market application which is collecting some analytics data.  I'd like to tell the analytics to end session and report, then resume the system shutdown.</p>
  
  <p>I've tried triggering the event from the onDestroy or onShutdown parts of the services, but the phone will shutdown without giving it time to report.</p>
  
  <p>Working around this by making many short sessions based on the activity screens yields non-sensical analytics information that I'd like to avoid.</p>