0

For my APP, one of the important function is to mute the iPhone, but I can't find any available iOS API that I can use to mute the phone(or change the ringer volume level to minimum). Is their a specific API for developer to mute (or change the ringer volume of) the phone, if their is not, is there a indirect way to do this?

Fengya Li
  • 4,459
  • 1
  • 14
  • 12

2 Answers2

0

I believe you can only mute other application sounds. You need to configure the AVAudioSession category :

AVAudioSession Class Reference : http://goo.gl/rh7CX7 .

Look for which fit the most for your application. You only need to set it once in your code (make sure it's called).

AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategorySoloAmbient, error: nil) // AVAudioSessionCategorySoloAmbient is default AVAudioSession.sharedInstance().setActive(true, error: nil)
modesitt
  • 7,052
  • 2
  • 34
  • 64
0

No.

Applications developed using the official SDK cannot change (and in most cases cannot even access) system-wide settings.

It is possible, but only using private API's. I only went as far as muting the ringer, but you should be able to control the master level as well.

See How to disable iOS System Sounds

Community
  • 1
  • 1
Moin Shirazi
  • 4,372
  • 2
  • 26
  • 38
  • 1
    You can try this also if it works for you float value = 0.0f; AudioSessionSetProperty(kAudioSessionProperty_CurrentHardwareOutputVolume, sizeof(float), &value); value = 10 for full volume and 0 for mute – Moin Shirazi Oct 12 '15 at 03:48