Using WakeLock to Keep A Stream Playing

Viewed 12050

I have a MediaPlayer running in a Service that's playing audio from a URL (streaming). As of now it appears to work well, and even continues playing when I put the phone in standby.

I currently do not acquire a wakelock. My question is:

  • Is it actually necessary to acquire a wakelock in my situation?
  • If it is necessary, what type of wakelock should I acquire?

And yes, this is a legitimate use-case for wakelock, because my users explicitly want the audio to continue playing.

6 Answers
  mediaPlayer.setScreenOnWhilePlaying(true);

The documentation says: "This is the preferred method over 'setWakeMode' where possible, since it doesn't require that the application have permission for low-level wake lock access."

Related