0

I want to play music in my app, that i can do. But the problem is how can i continue playing music even if the app is not in foreground. The musiv should stop only when the user select stop button, or pauses it.

Thanks,

Any help will be most appreciated.

Piyush
  • 548
  • 2
  • 7
  • 19

4 Answers4

4

You should use service to play music. Refer to this.

1

try using Services or Async Task

Android
  • 8,995
  • 9
  • 67
  • 108
0

Try using a Service. That link gives a tutorial on how to use a background process. Hope this helps.

iamtheexp01
  • 3,446
  • 9
  • 35
  • 35
0

as the others said you could use Service

Or you could just make the song play in background thread, and make user back-key to back to their home screen via moveTaskToBack(true);

oers
  • 18,436
  • 13
  • 66
  • 75
Alfian Busyro
  • 2,295
  • 2
  • 17
  • 32