How to detect the ios device is in silent mode

Hi i have developed a application to play sound in some situations.

I don't want to play that sound when device is in silent/mute mode.

Is there any way to detect the device is in silent/mute mode in objective c???


Thanks in advance.

Probably, there is no such API. I think, Apple thinks that it is something personal and do not allow apps to detect it.

It is posisble to think about a more or less ugly workaround. For example, play (AudioServicesPlaySystemSoundWithCompletion) a sound with a predefined duration and if the finished callback is called in the expected time, so the device is not in the silent mode.

>> I don't want to play that sound when device is in silent/mute mode.


That is the default behavior. See:


https://developer.apple.com/documentation/avfoundation/avaudiosessioncategorysoloambient


Note that there are other categories that might be appropriate if your app does something more complicated with sound.

Have you seen this ? Semms to be solutions for it:

h ttps://stackoverflow.com/questions/287543/how-to-programmatically-sense-the-iphone-mute-switch

Thank You. Great Idea's no single A's

Context

Ms. J

How to detect the ios device is in silent mode
 
 
Q