26

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?

Community
  • 1
  • 1
Alex Coplan
  • 13,211
  • 19
  • 77
  • 138
  • 5
    Boring? No way. It's getting really tense. – Costique Feb 15 '12 at 20:32
  • @Costique updated accordingly :) – Alex Coplan Feb 15 '12 at 20:35
  • I don't think they do, look at Skype for example. There are even "jailbreak" apps that start these kind of apps for you. – fbernardo Feb 15 '12 at 20:37
  • 1
    If you use any VoIP apps on your iPhone (e.g. Skype), you could restart the device, attach it to the computer, launch Instruments and see if it's already running. My guess is that VoIP apps are registered with `launchd` and launched on demand. Of course, I may be wrong. – Costique Feb 15 '12 at 20:41
  • Apple Doc does not mention about auto-starting explicitly since it does not exist as such. You'd have to register on certain services like the 'significant change location service' from CoreLocation to re-activate apps from NOT RUNNING, as long as the end user did not switch off 'Background App Refresh' for the app, or overall, then it is not possible beside user interaction. – LenArt Aug 07 '14 at 13:38

6 Answers6

31

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.

Tim
  • 59,527
  • 19
  • 156
  • 165
  • This is interesting, can someone please confirm this? Are there real example apps that use this feature? – sch Feb 15 '12 at 22:57
  • Just wrote one (and blogged about it, if you don't want to dig into code): https://github.com/lithium3141/BootLaunch and http://lithium3141.com/2012/02/18/ios-launch-on-boot-apps-fact-or-fiction/, respectively. – Tim Feb 18 '12 at 08:22
  • @Tim If we use this method, will there be any issues getting the app approved by Apple? – abc123 May 29 '13 at 20:13
  • 1
    Yes. You're only allowed to specify the `voip` key if your app is actually a VoIP app and is using that launch-on-boot time to establish a listening socket for incoming calls. If Apple sees you specify that key without providing any VoIP functionality, your app will be rejected. – Tim May 29 '13 at 20:22
  • @Tim I've just tried this out, and am unable to get this to work on iOS 6.1. After doing "reset launches", leaving the app running, rebooting, waiting then loading up the app again, the launch count is only 1, and it shows the current time. I have both voip and location background modes set. Perhaps this used to work, but is no longer allowed in newer iOS versions? – Tom Sep 05 '13 at 14:47
  • @Tom: very possible! I haven't tried this code recently; if I can get back to it, I'll update the repository & post. – Tim Sep 05 '13 at 15:31
  • @Tom: I was able to get this app working properly on a device running both iOS 6.1.3 and the iOS 7 GM. I'm not really sure what your issue might have been; what minor revision of 6.1 were you using? What kind of hardware? – Tim Sep 18 '13 at 03:10
  • It doesn't work in iOS 10 and above. The background location update will launch the application if you monitor the significant location change. But unfortunately it doesn't work if you set the passcode. – Bagusflyer Sep 12 '18 at 03:50
5

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.

user3344362
  • 51
  • 1
  • 1
3

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.

sercancici
  • 77
  • 1
  • 12
  • I think the main issue we are dealing with is: if before a restart the app wasn't running (BG/FG) then it won't autostart after the restart (When our app is VOIP for example). – OhadM Feb 15 '16 at 13:56
2

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.

sch
  • 27,436
  • 3
  • 68
  • 83
1

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. 
...
Qiulang
  • 10,295
  • 11
  • 80
  • 129
0

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.

lupinglade
  • 481
  • 5
  • 11
  • 1
    Hi, can you provide documentation for this? – joscas Oct 24 '13 at 22:47
  • As long as the end user did not disable the 'Background App Refresh' overall or for the specific app, otherwise it's blocked for this kind of re-activating via CL or VOIP e.g. – LenArt Aug 07 '14 at 13:36
  • 1
    According to [Location and Maps Programming Guide](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html) : `If your app is terminated either by a user or by the system, the system doesn’t automatically restart your app when new location updates arrive. A user must explicitly relaunch your app before the delivery of location updates resumes. The only way to have your app relaunched automatically is to use region monitoring or the significant-change location service.` – DefenestrationDay Dec 22 '15 at 12:00