Disable silent mode on iPhone? - 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.

Related

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 Turn on Music (ipod library) on iPhone?

I already know how to keep play music at background in my app.
I don't want to know that.
I want this.
how to Automatically turn on ipot music in background & sleep mode at custom time.
it's thought impossible to me.
but that's possible. and no jail break.
i wanna know that. please help me.
Take a look at the following background task guide from the iOS docs
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/BackgroundExecution/BackgroundExecution.html
There are restrictions on what can be carried out in the background. Certain apps that support audio, location, and voip are allowed to run in background using the UIBackgroundModes key. With the audio background task, it will not be suspended until the audio session stops.
It seems that you don't want to initiate a session until a certain time. You could potentially look at beginBackgroundTaskWithExpirationHandler: .
Also if you are looking for a timed alarm, you can always attach a different tone to a local notification.
As far as I am aware, there is no "out-of-the-box" way to do what your asking.

How to create a "return to app" status bar when app goes to the background?

When my app moves to the background while either playing audio or recording audio, I would like to provide something like the the green "In Call" status bar that appears when you are in a call and swap out to another app, giving you a quick "return to app" capability.
I thought this might be a private API, but I noticed the Griffin iTalk app does this when it is recording audio (see picture) - so I know it can be done, but I have not been able to figure out what the API is (the Info.plist setting, the AVAudioSession, the UIApplication/Delegate or the whatever) to make this magic happen. My app is currently working and recording audio in the background and works just fine, I assume there is some bit somewhere I'm not setting to get this behavior.
Can someone either point me to the right docs or sample code that exhibits this behavior? (I've scoured the Audio docs and haven't been able to find it).
Thanks!
There may be a private API to do this, but if you want to get into the App Store, the thing to do is to register as a VOIP app, which gets you the in-call status bar, like Skype or (I imagine) iTalk.
Actually the red-bar actually only appears when the application is recording audio in the background. I've only ever done this when marking the application VOIP and Audio.
You may be able to do this by only marking is as background Audio application only, but I haven't tried this.

Recognising iPhone Silent Mode

I would like to stop my application playing a sound if the user has switched the iPhone to silent mode. Where can I read that the phone is in silent mode? Is there some flag I can query? I noticed that some applications ignore the silent mode and some not, while I would have expected all apps to respect that silent is silent !!
Any hints or input would be greatly appreciated.
Thanks
Al
The Human Interface Guidelines published by Apple describes what is the ideal behavior for Apps to follow for Ring/Silent switch. So you may not need to disable audio if the user explicitly played that audio clip despite on silent mode.
The Ring/Silent Switch—What Users Expect
Users use the Ring/Silent switch to silence their devices when they want to:
Avoid being interrupted by unexpected
sounds, such as Phone ringtones and
incoming message sounds.
Avoid hearing sounds that are the
byproducts of user actions, such as
keyboard or other feedback sounds,
incidental sounds, or application
startup sounds.
Avoid hearing game sounds, including
incidental sounds and soundtracks,
that are not essential to using the
game.
For example, in a theater users switch their devices to silent to avoid bothering other people in the theater. In this situation, users still want to be able to use applications on their devices, but they don’t want to be surprised by sounds they don’t expect or explicitly request, such as ringtones or new message sounds.
However, the Ring/Silent switch does not silence sounds that result from user actions that are solely and explicitly intended to produce sound. For example:
Media playback in a media-only
application is not silenced by the
Ring/Silent switch because the media
playback was explicitly requested by
the user.
A Clock alarm is not silenced by the
Ring/Silent switch because the alarm
was explicitly set by the user.
A sound clip in a language-learning
application is not silenced by the
Ring/Silent switch because the user
took explicit action to hear it.
Conversation in an audio chat
application is not silenced by the
Ring/Silent switch because the user
started such an application for the
sole purpose of having an audio chat.
This behavior follows the principle of user control because it is up to the user, not the device, to decide whether it's appropriate to hear sounds the user explicitly requests.
You need to set the appropriate Audio Session Category.
You tell iPhone OS your application’s
audio intentions by designating a
category for your audio session.
For more detail see - Configuring the Audio Session
If the iPhone is silent, why stop playing a sound?
Or, does silent mode just not play certain sounds? I don't have an iPhone (iPod Touch) so I'm not sure.

Is it possible to programmatically mute the 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