0

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

Cœur
  • 34,719
  • 24
  • 185
  • 251
Maddy
  • 337
  • 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,229
  • 9
  • 91
  • 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,317
  • 1
  • 28
  • 51