I have an Android application that plays streamed audio from the Internet using the MediaPlayer
class.
How do I let it continue to play the audio on the background when the user hits the home button to run other applications?
While running other apps, I'd like it to continue to play the audio.
You have to use something called Android Services.
From the docs:
"A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use."
Here's the excellent official guide to using services to get you started: http://developer.android.com/guide/components/services.html
Here's a good tutorial on building an audio player: http://www.androidhive.info/2012/03/android-building-audio-player-tutorial/
Here's a video tutorial for building a streaming music player: http://www.youtube.com/watch?v=LKL-efbiIAM
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With