Is it possible to programmatically mute the iPhone? - iphone

I've seen techniques to make sure that an app respects the mute switch, but is it possible to set the iPhone to mute (no sounds from any apps) using the SDK?

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

It is technically possible to change the system volume through the private AVSystemController class in Celestial.framework, but will prevent your app from getting Apple's approval

As only one app can be running at a time, the only possible use I can think of for this would be to mute other people's apps, and it should be fairly clear why Apple prevents that.
What would I do if an app muted the iPhone and I didn't know it happened? It can't physically move the mute switch on the side of the phone, so that wouldn't match, and I'd have to figure out a) that the phone was muted and b) how to unmute it without the switch.

I can change volume using AVSystemController, it sets to minimum which is 0.06x. Is there class/API to mute it completely? toggleActiveCategoryMuted does not work

Related

Mute iPhone programmatically

I have been able to decrease the volume of Ringer by using AVSystemController's setVolume method. However, it doesn't mute the device, there is still 5% volume left. I might need to control the Silent switch but didn't find anything about it.
Please note I don't want answers like The app will be rejected by Apple as I do not intend it to upload.
It is technically possible to change the system volume through the private AVSystemController class in Celestial.framework
Get Framework from here.

How to override iOS System Vibration Settings?

I've just recently noticed that they're are two switches inside the Settings Application that say "Vibrate on Ring" and "Vibrate on Silent". If these switches are turned to OFF, I am not able to vibrate the phone from my application.
I currently call vibrate using:
AudioServicesPlaySystemSound( kSystemSoundID_Vibrate );
The question is: Does anyone know how to override these settings and vibrate the phone no matter what the settings are?
You can't change user settings for the core functionality of the phone. You build on top of the OS, not really in it. All the things we can do are because Apple created APIs to let us do so. If there was some crazy hack to get around that using undocumented APIs Apple would reject the app anyway. Happened to me once under a different circumstance over something super minor that I didn't know was "undocumented."

How to mute iPhone running iOS 5

I know this question is already asked quite some time. And I read all the topics at stackoverflow.
But there isn't a satisfying answer to my problem.
I'd like to mute my iPhone running iOS 5 programmatically. Many would say it isn't possible with public frameworks. I'm aware of that. The App I'm planning to code is for personal use only. I do not intend to sell it over the AppStore (yet?).
My research brought me to the conclusion, that there my be several ways to achieve muting an iPhone programmatically.
Use private frameworks
Hook functions or methods which are playing sounds
Replace default sounds (like ringtone, MailSent, iMessage, usw...)
Some thoughts to the above mentioned methods:
I class-dumped all headers of the private frameworks (in my Xcode-Installation) and didn't find functions which indicate (by their function name) to the wanted behavior
I think it's possible, but I do not know the functions to be hooked. Therefore, it would be quite some effort for to make this work (and I think I do not want to do this)
Giving it a second thought, this might not be a good solution. Maybe you can change the sounds. But then the phone isn't mute at all (games, YouTube,...)
I had given AVSystemController a chance using the methods changeActiveCategoryVolumeBy and setVolumeTo but those won't mute my phone but set the minimal volume of the ringer to 0.06 (or something).
There has to be a way to completely mute the iPhone, RingToggle (jailbroken app) is doing it quite good.
Does anyone has a idea how to do it?
I don't think you'll be able to mute the phone from a sandboxed app, even using private frameworks.
What RingToggle probably does is hook into the springboard and use springboard's methods to mute the phone; they are probably using a MobileSubstrate extension.

Assigning app functionality to silent/mute switch in iOS

Is it possible to programmatically link the physical mute/silent switch to an app function?
I would like to use the mute/silent switch as a toggle to lock/unlock aspects of an app (not sound-specific, but the app does not rely on audio so mute or not is actually moot. ;)
I think you can do that by capturing the hardware button call back; capturing the callback is explained by #John Fricker here.
But the app may be rejected by apple 'cos as per app store review guidelines
10.5 Apps that alter the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, will be rejected
No, it is only for Lock Rotation or Mute. You can choose it in Settings app.
but it seems to be possible to detect the state of the mute switch.
How to programmatically sense the iPhone mute switch?
This can be done, an app That does this will not be rejected by Apple because first, there's already two apps on the AppStore does this. Second the appstore review guidlines say that you cannot alter the standard function, but we are not trying to alter the finction, we are using the same function.

Disable silent mode on iPhone?

How do you disable the user from turning the phone on silent? (switching the switch on the top left of the phone?)
I want my app to always play sound no matter what the state of that switch is. Is this possible?
Thanks in advance...
Please search stackoverflow or the web for similar questions before posting a new one, this question has already been covered:
Play sound on iPhone even in silent mode
iphone, how to play sound even in silent or mute mode?
Be careful about overriding the silent mode switch and playing audio. Apple may not like you doing this, depending on the context; if they don't like it, you will fail app review. Is there a good reason to play audio when in silent mode in the context of your app?
Here’s what I have done that works great!
Set all your contacts Emergency By Pass OFF! Then decide who should break through by turning the Emergency By Pass ON to those important calls you simply can’t miss; Family members like Mom and Dad.
Now your all set to use he Silent switch.