IOS disables vibration alert when silently using software [Private API]

I want my iPhone to not vibrate when it is turned on in Silent Mode, even when it is turned on in the settings. I want to do this programmatically from an application. This is for me, so I can use a private API. Is there an api that controls the sounds in settings? Do you know any solution?

Thanks,

Flo

+7
ios settings iphone-privateapi vibrate
source share
3 answers

I think the following code can do the trick. You need to initiate this from somewhere, though (I don’t understand if you want it to be launched using the button or from the application).

NSString *sbPath = @"/var/mobile/Library/Preferences/com.apple.springboard.plist"; NSMutableDictionary *sbDict = [[NSMutableDictionary alloc] initWithContentsOfFile:sbPath]; [sbDict setValue:[NSNumber numberWithBool:NO] forKey:@"silent-vibrate"]; [sbDict writeToFile:filePath atomically: YES]; notify_post("com.apple.SpringBoard/Prefs"); 

I have not tried it myself, but found something like what you are looking for in Smartvibrate setup. This will change the parameter setting, so you must change it to turn on when your application ends.

Hope this helps!

+1
source share

Update for ios 8:

 NSMutableDictionary *dict; BOOL newState = NO; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; dict = [[defaults persistentDomainForName:@"com.apple.springboard"] mutableCopy] ?: [[NSMutableDictionary alloc] init]; NSNumber *value = [NSNumber numberWithBool:newState]; [dict setValue:value forKey:@"ring-vibrate"]; [dict setValue:value forKey:@"silent-vibrate"]; [defaults setPersistentDomain:dict forName:@"com.apple.springboard"]; notify_post("com.apple.springboard.ring-vibrate.changed"); notify_post("com.apple.springboard.silent-vibrate.changed"); 
0
source share

Update to @ baptiste-truchot's answer (and @vrwim's concern):

This requires

 #include <notify.h> 

at the top of the .h file.

Apple Doc about notify.h

0
source share

All Articles