2

I already know I can play a sound file using

SystemSoundID audioEffect;
AudioServicesCreateSystemSoundID((__bridge CFURLRef) fileURL, &audioEffect);
AudioServicesPlaySystemSound(audioEffect);

and how to restrict it to Silent-Mode-OFF-only using AVAudioSessionCategory and I also know how to vibrate the device:

AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);

But how can I vibrate the device ONLY when Silent Mode is ON (mute switch active)?

Is there an "official" solution or do I really have to check the state of the mute switch using one of these (kind of "hacky") methodes?

Community
  • 1
  • 1
YourMJK
  • 1,429
  • 1
  • 11
  • 22

0 Answers0