Respring from PreferenceLoader

815 views Asked by At

I'm using Preference Loader to load my custom settings into the settings app. I would like to know how to make the device respring from my Preference Loader settings panel. Please help me. Thanks in advance.

Ive tried system("killall SpringBoard"); but nothing happens.

1

There are 1 answers

0
Nate On BEST ANSWER

There's probably many ways to do this, but one way is to take advantage of the same technique I used in this answer. Essentially, the problem is that you're not issuing the command with sufficient privileges.

You can get the privileges you need by moving the killall SpringBoard command into a command script that gets run by SBSettings' privileged daemon.

See reference document here, under Calling External Functions and Scripts ....

You would make an executable script named (for example), com.mycompany.respring. In that script, add

#!/bin/sh
killall SpringBoard

and save it under /var/mobile/Library/SBSettings/Commands. Then, from within your preference bundle's PSListController, you would add this code:

#import <notify.h>

and

notify_post("com.mycompany.respring");

Posting that custom notification will cause SBSettings' daemon to run the script file of the same name. Of course, this forces your package to depend on SBSettings (which you can do by placing this in your package's DEBIAN/control file):

Depends: preferenceloader, sbsettings

... but as it's free, stable, and widely used and loved, that doesn't seem like a big limitation.