How to create kiosk-mode iPhone app? - iphone

I'd like to run an app in the KIOSK mode, so that it
auto-starts after starting the device
re-starts after app crash/power loss/etc.
Any ideas how to do this on a [probably jailbroken?] iPhone?

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.

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

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.

Related

Is there a way to detect the running app, while my app is in the background in ios?

I need to detect the running application when my ios app is in the background. Basically I need to know if the user launched the Safari app?
Is there any way to do this? as I know when an app is in background, it may suspended or it could do only a minimal of things. Any help is very much appreciated.
you can only detect if your app is going to the background, no info is available regarding others apps.
One caveat is that within your app, you can test for another app being available:
- (BOOL)canOpenURL:(NSURL *)url
This can tell you whether the current device has a specific application installed IF that application is setup to handle url schemes for launching from another app.
Apple's Docs
No, there is no such way. Anything you're trying to know outside the scope of your app is forbidden by Apple.

How to reboot or reload iPhone app programmatically in iOS

I have dowloaded an xml file that contains some update parameters and then I need to reload these parameters and init some views. Easiest way is to apply this configuration on next app boot. Is there any way to reboot iOS application programmatically?
Thank you.
Rebooting the app is a bad idea, I'm pretty sure Apple would reject it. However, You could display a popup telling the user to open a close the app to apply your updated information. But the best way would be just to manually call the methods needed to rebuild your app (I.e. the ones that need to use the updated data).
If you have to do some extensive rebuilding (i.e. things that the user would immediately notice) it might be a good idea to add in a "loading" progress bar of sorts.
You can't reboot your app, and I don't see why you would a) have to b) EVER WANT TO.
You can quit and restart an iOS app with a bit of user assistance. Set the app's plist key for application exits on suspend. Create a local notification for your app to trigger a few seconds into the future. Then send Safari a URL. The OS will terminate your app when launching Safari to handle the URL. The URL might be to a web landing page telling the user that a relaunch is in progress. Then the local notification will go off and ask the user to relaunch your app.
However an app should be (re)designed so that there is never a reason to do this.
You can do it only if your device is jailbroken
Put a reboot button in your app and call abort();. This will crash the app.
Hook the -(void)exitedAbnormally; from SBApplication and write code to launch your app.
If its not jailbroken, you have no choice
if you develop for jailbroken devices you can use uicache command to clean the springboard cache and reload new apps/icons (available from UIKit package).
for example,
1) if you're under root:
su mobile -c uicache 1>/dev/null 2>&1
2) if you're under mobile:
uicache
for reboot you can use rebootcommand under root and killall SpringBoard for respring

Launch emergency App/Do emergency call without screen-unlocking the iPhone

I want to run my application without opening the slide lock of iPhone the icon of the app should be displayed on the home wallpaper or screen. by tapping on the icon the app should run its an emergency service application. So is there any service provided by apple like calling emergency numbers without opening lock.
please suggest me
thanks..
No. You have to launch all Apps through the home screen (Springboard).
There might be a way to do this when jailbreaking the device, though.
That same functionality, which you speak of, is exactly what runs on the iPhone BEFORE it is "activated". I wonder if there is a way to use this already built in app to create what you're shooting for.

Iphone application run in background without backgrounder(Cydia)

Is it possible to write application via cydia to run in background like appsyn? Work with jailbreak device.
Without Backgrounder(Cydia)
Or is it possible to hide icon form springboard and hide arrow(Corelocation)?
i want to run my app like run plist in background.
please help me
Thank(Advance)
Yes, it is possible. In fact, I originally wrote Backgrounder for exactly this purpose; to act as a model for others to use.
You must do two things:
Make certain that you app installs to /Applications/ (and not /var/mobile/Applications).
Create your own UIApplication subclass, and add the following method:
- (void)applicationSuspend {} // Do nothing
However, if you are targetting iOS 4.0 or newer, you should consider using one of Apple's provided multitasking methods.
Also, depending on what you are developing, it might be wiser to create a daemon (or daemon/client) instead.

Background iPhone app for Jailbroken phones

I develop apps for jailbroken phones, and I need my app to be backgrounded and to be able to keep running as usual when backgrounded.
On iOS3.0, I would just block the thread at applicationWillTerminate, and that'd be it. But it seems that the fast app switching method in 4.0 is disabling applicationWillTerminate, so I can't use that anymore.
I've tried overriding applicationSuspend by calling it, but that doesn't appear to work either.
Do you guys have any idea how to do this?
Thanks
Maybe you need to intercept the new methods triggering the quasi-backgrounding process set by Apple.
-(void)applicationWillResignActive
-(void)applicationDidEnterBackground
-(void)applicatonWillEnterForeground
-(void)applicationDidBecomeActive