Pergunta

I have a very weird problem. The volume button can only adjust the ringtone volume instead of volume inside my application. There must be a way to control it. Because I found some apps can adjust ringtone volume and some apps can adjust volume.

In another word how to category my app as an "music" app so that I can adjust eh playback volume instead of the ringtone volume when I press the hardware volume key.

Can somebody help? Thanks

Foi útil?

Solução

Use the following code will allow user to adjust the volume of play instead of ring tone.

AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top