Reputation: 11
I'm using the AudioServicesPlaySystemSound (kSystemSoundID_Vibrate) to vibrate the phone but it only works when Settings > Sounds > Vibrate switch is on. How can I vibrate my phone when Settings > Sounds > Vibrate switch is off programmability. My phone is jailbroken.
Thanks!
Upvotes: 1
Views: 814
Reputation: 50697
The vibrate option switch needs to be turned on.
You will need to edit com.apple.springboard.plist
NSString *sbPath = @"/var/mobile/Library/Preferences/com.apple.springboard.plist";
NSMutableDictionary *sbDict = [[NSMutableDictionary alloc] initWithContentsOfFile:sbPath];
[sbDict setValue:[NSNumber numberWithBool:YES] forKey:@"ring-vibrate"];
[sbDict setValue:[NSNumber numberWithBool:YES] forKey:@"silent-vibrate"];
[sbDict writeToFile:sbPath atomically:YES];
/* Check to make sure the settings took */
AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
You can also send a notification to update the preferences. I'm not sure if this still works though.
notify_post("com.apple.SpringBoard/Prefs");
Upvotes: 1