Prevent Application Shutdown iPhone - iphone

I'm building a little dialing program for my kids so that only 4 "safe" numbers are available for them to dial. I'd like to start the app, hand them the phone and have the app be the only thing running until they come back home.
Is there a way to keep the application running and prevent the iPhone from shutting down the app?

The iPhone SDK does not allow this. Any application can be exited when the user presses the home button. In fact if your program takes too long to exit (e.g. infinite loop) it will forcefully close your application.
If you must have this behavior, your best bet would be to jailbreak the phone in which case anything could pretty much be done.

Not with Apple's SDK, no.

Related

How lost phone finding Apps ring the iphone even in Silent mode and App Killed stated

There are many 'Apple Device Finder' Apps in the store. Many of them help the user to ring the iphone even when the phone is in silent mode. I am trying to find out how this is achieved. How can we play sound on the iPhone which is the silent mode. Anyone knows the Apple-supported Framework or library to achieve this. I have not found any threads on how can an app makes phone ring on silent mode and even in the app killed state. Please help me.
I actually doubt that's possible. I think just iCloud "Find my iPhone" feature is able to do that.
For example, TuneIn alarm feature requires app to be open. If you kill the app, effectively it can't do anything. The only thing it would be able to do is to receive a push notification; but that's not handled by the app itself, but the OS.

power on events in iphone

I want to know whether we can get power off or on events in iphone. In other platforms like Android, BREW we will get a notification to our app saying the phone is turned ON. Is it possible in iphone?
Thanks
Jithendra
Short answer: no.
Your app isn't running on power-on, so there's nothing to notify. (A special case here would be apps registered as VoIP clients. But you still can't tell whether the handset just started or whether your app was killed for some other reason and then restarted.)
And when iOS shuts down it will send KILL signals to any background running tasks. You can't intercept them, so that doesn't really help you. (And even if you could, again, it doesn't say why your app is being killed.)

Start my iPhone app on the end of call

I want to develop an app which records the call-duration etc.. when a call is finished. So is it possible to start my app when the user finishes his call.
App is currently not running and then
User Finishes his Call ---> My app should open up the moment he finishes his call giving me the details about call duration etc.. and then i ask for some comments on that page and exit the app.
I already made such an app in Android,Blackberry.
P.S: Even if it works on a jailbroken iPhone it is good enough for me.
There's no way to do this on a regular iPhone. Apple's APIs don't allow you to interfere with phone calls at all.
Not sure about jailbroken phones though. In theory, you can do anything, it just depends on how much time you're willing to spend on it. Good luck.

programmatically prevent app from running in background iOS

I have an app that will run in the background but there is one case where I do not want that to happen, can I achieve this programmatically?
I know I can opt out by changing this plist value but what about at run time?
Add the variable UIApplicationExitsOnSuspend (Application does not run in background) to your applications plist and assign the value YES.
You can close the app by calling exit(0) in applicationDidEnterBackground.
You can't use exit(0) b/c apple does not allow you to close the app without user knowing it.
From Technical Q&A QA1561 How do I programmatically quit my iPhone application?.
There is no API provided for gracefully terminating an iPhone
application. Under the iPhone OS, the
user presses the Home button to close
applications. Should your application
have conditions in which it cannot
provide its intended function, the
recommended approach is to display an
alert for the user that indicates the
nature of the problem and possible
actions the user could take - turning
on WiFi, enabling Location Services,
etc. Allow the user to terminate the
application at their own discretion.
Calling exit() is discouraged, and not informing the user that the app is going to terminate is also discouraged. So you need to get the OS to kill your app (as it normally would do over a long enough period of operation) while simultaneously informing the user. One way of doing this, while using only legal APIs, is to dirty absolutely as many memory pages as possible (malloc and bzero), then call Safari with a URL to a hoggish website explaining why the app is going to quit. Safari will require enough memory to display the website that your app will be terminated by the OS, just as the user is being properly informed.
Sleeping until the OS kill timer kills your app will also kill your app, but this non-responsive delay will lock up the UI, which isn't a good user experience.

forbid exit from iphone/ipad application

is it possible and how to implement forbiden exit from application on iphone/ipad?
we have an application that must permanently work on ipad device. user should not have any way to exit from application. could you advise how to implement this functionality?
By jailbreaking it and installing custom software that enables you to do that.
Or putting a lot of tape over all the buttons.
Anyways, you can't do this with a standard app on a standard device. Just think about it - would be a pretty annoying thing for apps to do, wouldn't it?
Apple's own human interface design guidelines would forbid this. Your app can't encroach on the abilities of the OS that transcend your own application's responsibilities. The whole point is to have a consistent experience for the device and if you're modifying something as fundamental as switching apps, you're violating that principle.
If you can't exit the app, you're essentially turning your device into a single purpose unit. How do you expect to get back to the app list if you disable fast app switching and the home button?
Whatever solution you find would not be approved by the app store.
You should look at whether the current multitasking features can help chip away at your reasoning for needing the app to always run in the foreground.
If you are talking about an enterprise app locally distributed, you might be able to do this, though probably not.
The best idea would be to physically break or block the hardware button.
Or issue alerts to the device every 10 seconds making the thing effectively unusable when outside the application (you can ignore incoming notifications for you in-app).
Why do you have this requirement?
There is no way to implement this functionality. You cannot do it.
You can't do it, But if you jailbreak and configure the "Home-Button" settings you can :)
Btw, If you do it, the only way to quit will be a shutdown... And to shut down every time would be kinda annoying...