简体   繁体   中英

Android add audio playing via Music Player to OS default player?

So the idea is - when we play audio in Music app in Android and press home button then swipe from top of the screen, we can see the audio playing in default OS player with play/pause controls and audio continue play.

Now what i need to do, i play an audio by using Media Player in my app and if user press home button, the audio need to play continue as in case of music app. But i have no idea how to add audio in OS default player? Any help or suggestion would be highly appreciated.

You need to play audio using music service for background play. And for notification you have to make custom notification with different media player control buttons.

See this for music service:

http://developer.android.com/guide/topics/media/mediaplayer.html
http://code.tutsplus.com/tutorials/create-a-music-player-on-android-song-playback--mobile-22778

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