Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top