I've written a small toggle to enable and disable the vibration after I saw the toggle, which only deactivates the vibration in silent mode. For that I'm changing in the plist files the bools, which works very well. I can even see the result in the Settings.app. But my problem is, that it vibrates like nothing happens. How can I tell the iPhone, that something in the plist files changed, but without a respring?
please help me.
ps: When you want to see my code, I've copy and pasted the important part here:
void setState(BOOL enable) // required; called when user presses toggle button
{
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.springboard.plist"];
if (enable) // toggle is disabled, so enable it
{
[dict setObject:[NSNumber numberWithBool:YES] forKey:@"ring-vibrate"];
[dict setObject:[NSNumber numberWithBool:YES] forKey:@"silent-vibrate"];
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
else // toggle is enabled, so disable it
{
[dict setObject:[NSNumber numberWithBool:NO] forKey:@"ring-vibrate"];
[dict setObject:[NSNumber numberWithBool:NO] forKey:@"silent-vibrate"];
}
[dict writeToFile:@"/var/mobile/Library/Preferences/com.apple.springboard.plist" atomically:YES];
isToggleEnabled = enable; // for getStateFast() use
}
Ok. I've got the problem. I forgot to push a notification like
notify_post("com.apple.springboard.ring-vibrate.changed");
This notification can be checked with the "notificationWatcher" command in the Terminal.