-2

I making mp3 player with ionic. I use "cordova.plugins.backgroundMode.enable()" for play music in background if close the app.

But when press hardware back button on Android is "stopping and closing" the app instead of just "closing and go back".

hanie
  • 11
  • 4

1 Answers1

0

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

Dinesh Saini
  • 335
  • 1
  • 12
  • Thanks dear but i use ionic and angular and i think its different to writing java in android . – hanie Aug 27 '16 at 06:30