iOS: How do I detect if music is playing in any background music app?

Check out this question

Seems you can see if another audio is playing by checking the property kAudioSessionProperty_OtherAudioIsPlaying like this:

UInt32 propertySize, audioIsAlreadyPlaying=0;
propertySize = sizeof(UInt32);
AudioSessionGetProperty(kAudioSessionProperty_OtherAudioIsPlaying, &propertySize, &audioIsAlreadyPlaying);

A complement to this could be to ask the user if he/she wants to have the game music or the already playing sound/music.


AudioSessionGetProperty (as mentioned in jake_hetfield's answer) is deprecated as of iOS 7.

Instead, try this one-liner that uses isOtherAudioPlaying:

BOOL isOtherAudioPlaying = [[AVAudioSession sharedInstance] isOtherAudioPlaying];

Works on iOS 6+.