Detect silent mode in iOS 7

前端 未结 1 1730
悲哀的现实
悲哀的现实 2020-12-01 15:31

is there any way to detect silent mode in iOS 7?

the following code does not work for iOS 5 or later version

-(BOOL)silenced {
     #if TARGET_IPHONE         


        
相关标签:
1条回答
  • 2020-12-01 15:53

    Check this thread - Detecting the iPhone's Ring / Silent / Mute switch using AVAudioPlayer not working?

    And this API - SoundSwitch

    How it works:

    • Play an audio file of 0.5 secs, every sec (after completion..)
    • Check how long it took to play the sound
    • Callback called real fast? nothing was played (silent switch is ON)

    Enjoy!

    0 讨论(0)
提交回复
热议问题