You’re a developer! You’re the coolest person on your block! You want to know how to detect if the mute switch on the iPhone is flipped (ya know, for reminding dumb user why their phone isn’t playing any sound.) Well, I stumbled upon a solution – and I thought I’d share. Our goofy app, Wookiee Translator was about to be updated with this new detection before we pulled it from the store.
In the Wookiee Translator, I set up a timer to calculate how long it was from when the sound file is called to play, to when it finishes playing. If that timer check returns a value less than the shortest sound files, then I know the mute switch is flipped, and can alert the user.
And please, leave a comment if this is helpful!
Great tip. Thanks for the post, I was frustrated with no API call to check for mute, and this workaround works great!
Hi,
I tried our tip with 4.0.2 but it didn’t work reliably! Maybe they changed something…
Markus