Can iPhone apps start on start-up? - iphone

I've answered two different questions now, both explaining how VOIP apps don't start on start-up, yet people seem to think they do.
I'm not 100% sure myself, someone linked me to a part of the apple docs, which doesn't really mention anything about auto-starting of apps.
I was originally going on prior knowledge and this answer, but after another person saying that they do, I'm really not sure.
As far as I'm aware, apps only react to push notifications, and can't be launched into the background when a device is turned on.
Can we please clarify whether it is possible to auto-start an app or not?

Take a look at the UIBackgroundModes section in this document - it seems to state that adding the voip key will autostart an app on boot.
Edit: a sample app seems to confirm this behavior.

I confirm that setting VOIP mode works. However, I've found that the app won't restart after power up unless it was running when the device was powered off. Furthermore, the app won't actually restart on the recently powered up device until the device is unlocked after power up.

OK, I don't know if this classifies as an answer but I feel obligated to say. I am developing an app that both tracks significant location changes and provides VoIP features. The app has voip key in Required background modes. I tried some cases which I would like to share the results:
App is in Debug mode - Turned off while app was running (active or background) - iOS 7.1.1 (11D201) and iPhone 4 (product name: iPhone3,2):
When booted, app is running in background, as well as other apps that were running before. I do not think this is related to VoIP in any way.
App is in Debug mode - Turned off while app was terminated - iOS 7.1.1 (11D201) and iPhone 4 (product name: iPhone3,2):
When booted, the app is not running, there are no logs in configuration utility, server says the user is not registered I cannot call it from other devices; and yet the other apps that are not related to voip or location tracking but were open before turning off are at least loaded in memory. Meaning, the voip key did not work.
I have continued the test with the same app but this time downloaded it from app store. The results are the same. Changed the device and os to iPhone 3G (product name: iPhone2,1) and iOS 6.1.6 (10B500). Nothing changed both in debug and release modes.
I have told my boss that Apple provides this behavior and it can be done. Then I had second thoughts and tried, now I am desperately trying to find another way. Going to send my regards to Apple about this.

You can not launch an application without user interaction. The user has to click on the app icon, on push notifications, on a custom link. May be there are other ways I am not aware of, but even if they exist, they require user interaction to intentionally launch the app.
Edit
It turns out, as Tim mentioned, there might be an exception for VOIP apps.

I have been developing VoIP apps and I can confirm that VoIP app will autostart when iPhone reboots as long as user doesn't kill it before reboot. When iOS autostart voip app only application:didFinishLaunchingWithOptions: will be run, i.e. applicationDidBecomeActive: won't be run.
I used to doubt whether iOS will automatically restart the voip app when it crashes. After investigating I find iOS does automatically restart the voip app but if it keeps crashing iOS will then try servals time before it finally gives up.
If you check iPhone console output from xcode, you can see logs like these after the first crash
..
Service exited due to signal: Abort trap: xxx
Unable to get short BSD proc info for xxxx: No such process
Application 'UIKitApplication:xxxxx]' crashed.
...

Significant location change or region monitoring also causes an app to launch on boot as long as its turned on and left on. No UIBackgroundModes key is necessary for this.

Related

Required Background Mode for location not re opening app after reboot

We are trying to develop an application similar to an existing app currently in the app store.
This app is sending location data in the background to a web service, and the app will continue to run following a reboot of the device. I will also note, that following the app being installed and registered, the location services indictor remains constantly on the status bar. I am assuming this is necessary to allow the app to continue to run following a the device being restarted.
We have tried using the "UIBackgroundModes/required background modes for location", and have been unsuccessful in having the app continue to run following a reboot of the device.
Can someone please point us in the right direction as to how to have the app continue to send location data following a device reboot.
Thank you very much!
No app will run following a device reboot. It is not possible to build a file daemon under Apple's SDKs. You'd have to jailbreak the phone and run unauthorized stuff to do so, then you wouldn't be accepted into Apple's app store.
Yes your app will be restarted if your are monitoring significant location changes or monitoring a region and that region is entered/exited.
In iOS 7 Apple made an important change that will disable these mechanisms if a user force quits your app. They will remain disabled until the user starts your app again.

iPhone - app which can not be killed

I am trying to understand, is there any way to develop iPhone app with following conditions:
1) This application should always run in the background
2) This application should not be killable
3) With out JailBreak?
All I am trying to do is want to track my iPhone.
Please help me.
Thanks
It's not clear exactly what you want to do, but one of the cases where Apple allows apps to run in the background is so that they can respond to changes in the GPS location. It's not unkillable per se, but apps do relaunch automatically (I think) if they're killed due to low memory, etc.
See here for the Apple docs.
No, this is not possible unless you are Apple.
No. I'm pretty sure attempting this is going to get your app rejected (if its even possible!). The iOS system has its own ways of managing running applications and will kill apps if certain conditions are met (e.g. unresponsive for a while).
Check out the App State & Multitasking doc.
Your requirements are:
1) This application should always run in the background
2) This application should not be killable
3) With out JailBreak?
Answer:
I think there is no Non-Apple app which has all the three features. I think even one of these feature is nearly not possible.
Also if you say that Photos and Phone and others like Newsstand cannot be deleted, then you need to consider that those are apps of Apple and they have some more capabilities than what they give in Public API's to the developers.
They have some greater access to the iOS and many of its private API's which make them non-deletable.
Hope this helps you.
If you don't plan to release it to AppStore, but rather will sign with enterprise distribution certificate and will use it in your enterprise then you can look at VOIP application for iOS. It runs in the background, system restarts it automatically. I think that's the closest you can get on non jailbroken device.

how to see iphone logging (NSLog) after app restart?

How could I view iphone logging (eg NSLog) after app restart?
I'm interested in the answer both for using the (a) simulator and (b) an IOS device.
Background - In this case I have some issues no doubt in my code with how the application is supposed to launch, get previous state, and goto the controller/view it was at prior to it being terminated. Hence I want to see the logging as it starts up.
For seeing device logs, you can use Organizer tool available in XCode(your device should be connected with system).
For simulator you will have to re-run application from XCode.
Thanks,

iOS (Apple): Is there any way for the application to ask the OS to block the device in that application?

I would find useful, in some cases, and under the user's permission, to block the device so only the running application can be accessed unless the usrer's password (pattern or whatever is used to unlock the session) is introduced.
I guess the mecanism should be something like: The application asks the os to do this, the OS asks the user for permission and then the application asks the device to block the application on "exit" or standby (or both).
This would be useful for using an iPhone or iPad as a device for public use. One example could be a Library where visitors can see the book list and some previews in the device. In this case, you don't want the user to access any other resource/application in the system.
Does it make sense?
What your asking is there any type of kiosk mode for iOS devices.
The short answer in no. The longer answer is if you're using a Jail broken device you might be able to relaunch the app on exit, but it would take significant R&D.
I hade a client ask about this last week, after some investigation and thinking I told her,
It's best to look for a case that blocks the home button. Or some kind of security bracket. It'll be cheaper and easier.
Also any App you create with this functionality would be rejected form the App store.
If your looking for advice on programming Jail broken devices there is a Stack Exchange proposal you can follow.
Supposedly there's a way to have a "kiosk" mode with a .mobileconfig file. Both of these articles talk about it, basically covering the same territory:
http://joris.kluivers.nl/blog/2012/03/02/kiosk-mode-for-ios/
http://rick-hawkins.blogspot.ca/2012/01/turning-ipad-into-kiosk-device.html
I was looking into this again and found out that iOS already supports the feature. It is called Guided Access, it was incorporated on iOS 6, it does not require jailbreak and can be used for any app installed on the device.
It makes sense, but I don't think you can do that without jailbreaking the phone. In iOS, the home button cannot be overridden by applications. Besides there is cheaper hardware out there for kiosk-style applications.

Application on iPhone Startup

How can i make my application start on the iPhone startup?
If you plan on distributing your app via the App Store, this is not possible.
As Randolfo mentions, many things are possible via jailbroken installations.
You asked this question on 10th August 2010.
Now it's 13 November 2012. I'm adding this answer for future people who have the same question.
Now in iOS 6. There is a built in feature called guided access. You can achieve this feature using guided access. Still now you can't do this through code.
Please check these links:
enable-guided-access-ios
tip-how-to-turn-on-guided-access-in-ios-6-put-ipad-into-guest-user-mode
You can only do it with a jailbroken phone.
Only some very specific background applications can be started right from the iphone startup.
This includes VOiP applications for instance:
"Including the voip value in the UIBackgroundModes key lets the system know that it should allow the application to run in the background as needed to manage its network sockets. An application with this key is also relaunched in the background immediately after system boot to ensure that the VoIP services are always available."
As taken from:
http://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html#//apple_ref/doc/uid/TP40007072-CH5-SW15