0

In iPhone, how to override default setting of vibrate and sound programmatically?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Maddy
  • 345
  • 1
  • 3
  • 10

2 Answers2

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.

Community
  • 1
  • 1
Buntylm
  • 7,345
  • 1
  • 31
  • 51