Search code examples
iphoneobjective-cios4backgroundavaudioplayer

iPhone app: when App starts it stops the music player of the other app


In my iPhone App to keep app running in background I have implemented AVAudioPlayer which helps me to run timer in background mode and using timer it starts and stop updating location manager to preserve battery life.

Now the problem I am facing is: if some other app is playing music in background and I starts my app it stops the player of the app which is already running in background.

How can I make the music player running of the app which is running in background?


Solution

  • First you are abusing the background mode audio, which will get your app reject. If you want to use location updates in the background just set the background mode to location.

    And change the location manager to only tell you about a location change on major update.

    The way you want to go is not an option, since there can only be one audio app running in the background at a time.