I'm trying to play a playlist with the android media player. When one track ends; i stop the media player and init it again with the new one. Everytime i init the player I set the wake lock with this line;
mMediaPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
For testing; i start the player and lock my phone screen. After a couple of tracks; the player stops and cannot pass to the other track. When this happens i wait a couple of minutes more. Then when i open my phone screen; the player starts immediately.
Is there any posibility that the mediaplayer releases the wakelock somehow? May be between the track switching in the playlist when it stops? Is the "MediaPlayer.setWakeMode" proper way to do it when dealing with playlists? Or should i use "PowerManager" class directy?
This problem takes too much time to test. Thx in advance.