How do I allow my app to continue running when it is not in the foreground, or the phone is locked

112 views Asked by At

I'm making a internet radio android application that streams using MediaPlayer. However, I want it to continue streaming music in the background when the phone is locked, or I'm using another application. I can't find anything online for this and it's very frustrating, does anyone have any solutions or tutorials I can use?

1

There are 1 answers

0
M.Baraka On

You need to use a service and you can play media player from there, you probably will need your activity later to communicate with your service to get some information from the player ( by binding your activity to the service or using broadcast receiver)