What is a good way to play streaming audio in the background so that audio continues to play while the user switches between activities of the app, but stops whenever, for example, the user has an incoming phone call?
You can use AsyncTask to continue playing audio even if user switches or move to another screen.
That's not a good idea, as AsyncTask's are part of the Activity, and thus eligible for termination whenever Android feels like it. Services are better suited for longer-running tasks.
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!