title: Purpose of WakeLock in modern Android?
body: <p>I'm having a hard time understanding the purpose of <a href="https://developer.android.com/reference/android/os/PowerManager.WakeLock" rel="nofollow noreferrer">WakeLock</a> in modern versions of Android, after the introduction of Doze and Foreground Services.</p>
  
  <p>It appears as if WakeLocks are pretty much legacy as this point (although not marked as deprecated), replaced by Foreground Services (as WakeLocks are not actually respected by <a href="https://source.android.com/devices/tech/power/platform_mgmt" rel="nofollow noreferrer">Doze</a>).</p>
  
  <p>From the <a href="https://developer.android.com/training/scheduling/wakelock" rel="nofollow noreferrer">documentation</a>: "One legitimate case for using a wake lock might be a background service that needs to grab a wake lock to keep the CPU running to do work while the screen is off" - But this isn't really true anymore after the introduction of doze and foreground services, is it? </p>
  
  <p>Is there still a legitimate use case for using WakeLocks (instead of e.g. a foreground service)?</p>