简体   繁体   中英

Android: MediaPlayer and AsyncTask Wakelock

I have an Activity that uses AsnycTasks to reset and restart a MediaPlayer after it finishes. This all works fine, but I want the MediaPlayer to continue playback even when the phone's screen is off. My first thought was a "PARTIAL_WAKE_LOCK", and this works great until it is time for the MediaPlayer to re-start it using the AsyncTask, at which point it stops.

How can I keep the screen off but still keep my processes alive?

Try android Services to play your Media files. You can also see this and this .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM