I have developed a chat app and the problem is notifications can be heard even if phone is on silent mode (1). The thing is, I want notifications to be played when screen is locked (2). I checked all AVAudioSession categories, and it seems that you can have either one of the following:
- Sounds disabled when phone on silent mode or screen locked;
- Sounds enabled even when phone on silent mode or screen locked.
How can I get sounds disabled when phone on silent mode, but enabled when phone NOT on silent mode and screen is locked? Is it possible to tweak the AVAudioSession further, or (apparently cannot) easily detect silent mode programmatically?