views:

436

answers:

3

Hi,

I'd like to run an app in the KIOSK mode, so that it

  1. auto-starts after starting the device
  2. re-starts after app crash/power loss/etc.

Any ideas how to do this on a [probably jailbroken?] iPhone?

+1  A: 

It will have to be jailbroken because the standard OS won't give you that level of control.

TechZen
A: 

Since you are already thinking jailbreak, perhaps look into launchd on the phone as whatever starts up Springboard could also probably be made to start up your app after.

Kendall Helmstetter Gelner
+2  A: 

The easiest method would be to create a mobilesubstrate extension that runs inside SpringBoard and throws up its own UIWindow.

Create a static __attribute__((constructor)) function and inside register for UIApplicationDidFinishLaunchingNotification. After receiving the notification, 99% of the standard iPhone SDK will work as-is.

rpetrich
thanks, can you provide more code/resources on creating mobilesubstrate extensions?
Konstantin
MobileSubstrate is simple enough; just compile your project with the `-dynamiclib` linker flag, ignore the codesign error, and move the compiled binary from `build/.../MyExt.app/MyExt` to `/Library/MobileSubstrate/DynamicLibraries/MyExt.dylib` on your device. If you are just creating your own `UIWindow` and such, the standard SDK will do; if you want to interact with SpringBoard itself, you will need to get SpringBoard headers (either via class-dump or some other source).
rpetrich