title: What is the definition of asleep for an android device?
body: <p>I'm using </p>
  
  <pre><code>alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, 0, DURATION, broadcast);
  </code></pre>
  
  <p>To schedule an repeating task that should only be executed if the device is not asleep. As I understand the <a href="http://developer.android.com/intl/de/reference/android/app/AlarmManager.html" rel="noreferrer">API</a> on the AlarmManager the intent will be called once the device wakes up from sleep. </p>
  
  <p>Now when is an Android device asleep? For testing I set the duration to two minutes and connected the device to my machine. Now I'm watching logcat and every two minutes it will spit out my debug message. </p>
  
  <p>I always thought that an deactivated screen means that the devices starts sleeping. 
  Or is my looking at the debug output preventing the device from sleeping? 
  I also disconnected the USB connection and looked at the log after half an hour and I could see a call to my timer code even if the display was dark for more then 15 minutes.</p>
  
  <p>How can I verify from which time the command is not executed anymore and what asleep refers to in the AlarmManager documentation? Is there a way to see from the logcat output when the device started sleeping?</p>