In iPhone, how to override default setting of vibrate and sound programmatically?
Asked
Active
Viewed 525 times
2 Answers
0
You cannot do that unless your doing it for a jailbroken device. Apple will not accept programmatically changing the phone settings. This is ultimately user preference.

Anil Varghese
- 42,757
- 9
- 93
- 110
0
I think You cannot(May be Possible if your application is run on a jailbroken device). Because there is no Apple API to access the iPhone settings. But you can Change the setting in your app Bundle.For Vibration You can Go with
#import <AudioToolbox/AudioServices.h>
and use
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
for Volume you can Go with
AVSystemController
[[AVSystemController sharedAVSystemController] setVolumeTo:10.0 forCategory:@"Ringtone"];
Try this SO Question and the Best will be however use MPVolumeView (volume slider) is there to change device volume but only through user interaction.
MPVolumeView is a control in toolbox, you need to add MediaPlayer.framework in your project then MPVolumeView will be displayed in toolbox in interface builder.