title: Distinguish Android onDestroy events
body: <p>I'll start by saying that I've seen the Activity Lifecycle diagram (<a href="http://developer.android.com/reference/android/app/Activity.html" rel="nofollow">http://developer.android.com/reference/android/app/Activity.html</a>) and actually I thouht that I understand it perfectly.</p>
  
  <p>How I andestood it is that if there is an onDestroy event, then there is no coming back and the activity is definitely in a process of being shut down.</p>
  
  <p>All the others that involve the ability to show the activity again are between onCreate and onStop (both inclusive).</p>
  
  <p>I am creating an application that polls a custom bluetooth device for some measurements result. I want the connection (Bluetooth) to be kept, but I also want to discover if the user kills the activity (from the taskbar by killing the application) so I can send one more thing to the device and disconnect the socket. So by what I understood, I can just put the code in onDestroy. It turned out however (Sony Xperia Z3 and Samsung Galaxy S2) that onDestroy is also being executed when the user clicks the power button, thus locking the screen. When the screen is unlocked, a new Activity (that is my guess) is created and onCreate is run. And as You can guess - my device is disconnected because of the code i put to onDestroy</p>
  
  <p>Normal automatic screen off + lock does not do onDestroy...</p>
  
  <p>So the point is:
  Is there a way to <em>distinguish the onDestroy</em> that really destroys the activity, and the onDestroy that will recreate the same activity afterwards when the user unlocks the screen? I want just to react to this really-really onDestroy event</p>