Piyush
Piyush

Reputation: 548

Play music in background

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.

Upvotes: 0

Views: 4241

Answers (4)

Alfian Busyro
Alfian Busyro

Reputation: 2340

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);

Upvotes: 0

Android
Android

Reputation: 9023


try using Services or Async Task

Upvotes: 1

iamtheexp01
iamtheexp01

Reputation: 3466

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

Upvotes: 0

user468311
user468311

Reputation:

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

Upvotes: 4

Related Questions