Ducking and Un-ducking Audio

So I am working on an app that requires audio files to be played intermittently and it should duck audio coming from the background...(such as music from iPod or Pandora). I understand that you need to activate your audio session, then upon completion of the audio playback, you deactivate the audio session to get the background sound to return to its normal volume.


My only problem I am having is that when there is no background audio playing, and the audio session is not active, the volume buttons on the side of the phone control the ringer volume and not the app audio volume. This is a problem for me, because I would like the user to be able use the volume buttons to control the volume of the upcoming audio alerts at all times. When the volume buttons are controlling the ringer, the user has no control over the app audio / alert volume.


I know of at least two fitness apps in the app store that are able to duck and un-duck background audio and the volume buttons are always controlling the app audio and not the phone ringer. This holds true whether there is other audio coming from the background or not. How are these apps able to deactivate their ducking audio session and still have the volume buttons control the audio of their app and not the phone ringer???


Any assistance would be greatly appreciated.

Ducking and Un-ducking Audio
 
 
Q