You mast read about "Using wake locks".
To ensure that the CPU continues running while your MediaPlayer is
playing, call the setWakeMode() method when initializing your MediaPlayer.
Once you do, the MediaPlayer holds the specified lock while playing and
releases the lock when paused or stopped:
mMediaPlayer = new MediaPlayer();
// ... other initialization here ...
However, the wake lock acquired in this example guarantees only that the
CPU remains awake. If you are streaming media over the network and you are
using Wi-Fi, you probably want to hold a WifiLock as well, which you must
acquire and release manually. So, when you start preparing the MediaPlayer
with the remote URL, you should create and acquire the Wi-Fi lock. For
WifiLock wifiLock = ((WifiManager)