4

This is a strange one, I have a need to create an iOS app that runs in the background on an iOS device, but can not be visible on the Home screen of the device. The app may need to show up in Settings to configure a few options, but it mostly needs to run behind the scenes.

I do not need to publish this app on the app store, it is strictly an enterprise app for my company.

Does anyone know how this kind of behavior might be achieved? Configuration profiles? API's? etc?

Edit: Jailbreaking the device is not really an option for us. We have to keep the devices as they are.

johnc
  • 39,385
  • 37
  • 101
  • 139
Brian
  • 723
  • 1
  • 8
  • 26
  • 1
    I could be completely wrong here, but from my experience this cannot be done because Apps are idle when moved to the background. @Kevin's method is probably the only option to pursue. – Brandon Buck Jun 05 '13 at 21:19
  • @ldav perhaps you misunderstood the question. He's asking how to get an app that doesn't show up on the springboard (home screens). – Kevin Jun 05 '13 at 21:21
  • @izuriel, Jailbreaking everone's phone! Good luck with that! – ldav1s Jun 05 '13 at 21:24
  • @Kevin, So how is the app started? Anyway, there's probably some restriction in the HIG link in the answer that says: no you can't do that. – ldav1s Jun 05 '13 at 21:26
  • @ldav1s Presumably on boot, like a background daemon. – Kevin Jun 05 '13 at 21:28
  • @ldav1s I think you're misinterpreting what you're reading here in the comments. Kevin pointed out that it only works on Jailbroken phones, of course you don't want to Jailbreak everyone's phones. The app couldn't be initiated by the user without it appearing on the Springboard (again, unless with Jailbroken tools). Kevin was just attempting to point how a way the problem could be solved. – Brandon Buck Jun 05 '13 at 21:29
  • @izuriel, If the only way you can get the app to run is on a jailbroken phone, with jailbroken tools, how can you not (when you deploy this app) jailbreak the rest of the phones it's deployed to, seeing that it's use is an "enterprise app"? – ldav1s Jun 05 '13 at 21:38
  • Jailbreaking the device is not really an option for us. We have to keep the devices as they are. – Brian Jun 05 '13 at 21:42
  • @BrianR my point exactly. – ldav1s Jun 05 '13 at 21:43
  • We really need just the app icon hidden from view of the user and off the home screen. The app will be running analytical data for the device and we don't want the user to quit it. – Brian Jun 05 '13 at 21:46
  • @RichardJ.RossIII, this should not have been marked as a duplicate (of the question it was). Brian is asking about an app that runs in the background, not using the word *"background"* as a verb (which is similar to the verb *"suspend"*). – Nate Jun 05 '13 at 23:44
  • @Kevin, and upvoters of comment ... I'm pretty sure that's not correct. See Victor's answer below. – Nate Jun 06 '13 at 01:29
  • I stand corrected. The SBAppTags entry works. – Kevin Jun 06 '13 at 02:25
  • @ldav1s You're missing my point. My point is not telling him to Jailbreak the phones. But that his only option is to Jailbreak. I'm not recommending it. If I wanted it to be my solution, I would have posted an answer, not a comment. I realize that it's not feasible, that's kind of obvious that jailbreaking all of your users phones is not feasible. I simply stated that the effect he was looking for was only achievable on a jailbroken device. It's not my answer. – Brandon Buck Jun 06 '13 at 05:06
  • @izuriel, as I noted in my comment to Kevin, it's not true that this is only possible via jailbreaking. See Victor's answer. – Nate Jun 06 '13 at 20:41

5 Answers5

4

Backgrounding

There are several methods to get permanent background execution:

a) Silent audio which is mentioned by JRG-Developer

b) Usage of beginBackgroundTaskWithExpirationHandler + turning location manager on/off (it will reset remaining time to 600 seconds)

Making app invisible

You can use SBAppTags in Info.plist (take a look at this: How to remove app icon programatically from jail broken iPhone app?)

It will make your icon not visible on Home screen.

Community
  • 1
  • 1
Victor Ronin
  • 22,758
  • 18
  • 92
  • 184
  • 2
    +1. I think adding `voip` as a background mode in the Info.plist will also auto-start the app when the phone boots, removing the need for an app icon. I tested this on my jailbroken phone, but I think it should work on a jailed device, too. – Nate Jun 06 '13 at 01:30
3

I've no idea how you can tackle the not be visible on the home screen criteria, but there are certain services that are allowed to be run in the background continuously, notably:

  • Background Audio (even silent audio)

While this is indeed very hacky, short of jailbreaking the devices, this may be your best bet.

While it's unlikely / very difficult to get past the review process, in the event for some reason you do need to (attempt) to publish this app to the App Store, some apps are even available on the App Store which take advantage of this hack, such as PasteBot.

You should definitely read their write-up here about getting their app's Cut-and-Paste functionality to work while in the background:

http://tapbots.com/blog/pastebot/pastebot-music-in-background

Another out-of-the-box idea, why not use Android devices instead, which do support multitasking?

JRG-Developer
  • 12,454
  • 8
  • 55
  • 81
  • Question specified it didn't need app store approval. `SBAppTags` value in Info.plist will hide the icon (see Victor's answer), and `voip` mode will autostart the app. – Nate Jun 06 '13 at 01:35
2

Two methods:

  1. Jailbreak. A jailbroken iPhone is essentially a Mac and you can use all Mac UNIX programming tricks - spawn a daemon (you can even ask launchd to do that), or something. You can set up enteprise-wise Cydia source. Refer to saurik's website for a walkthrough and set up an experimental server using Ubuntu (which used apt too)

  2. A non-jailbreak way may be possible, but it will depend on what your app is doing. You can try use enterprise-wise push notifications.

Maxthon Chan
  • 1,181
  • 8
  • 15
1

Given that this is impossible to do on non jailbroken phones, I'd suggest the following:

  • develop a directory app, or a phone list app, something that is specific to your company.

  • have it connect to a web service once a day to register the device ID (so you know the user has not deleted the app)

  • tell users they need to keep the app open at all times (and if a user's device does not register one day, send them an email asking them to launch the app).

Now you can send back whatever you want with the app. If they kill it, you'll know the next day when you have a script look at the logs.

If you think this is a terrible idea, it is, but its the best you are going to get on iOS right now.

EDIT: you could send a notification every day - say in the AM - to make sure the user opened the app if it wasn't running.

David H
  • 40,852
  • 12
  • 92
  • 138
  • Actually, I think this is possible without jailbreaking (note that he doesn't need App Store approval). Of course, I can't add an answer because the question was closed as a duplicate of another question that was clearly asking something different. – Nate Jun 05 '13 at 23:45
-2

From my experince, this kind of behaviour cannot be achieved on iOS. When an app enters into background, it is active only for a small particular amount of time. After that, it goes into hybernate state. It stops working. So the behaviour you said can not be achieved without abusing iOS workflow. Thats why some call iOS's multitasking as not true multitasking. Only jailbreaking might help your case. That was for one case. The second one where the app cannot be seen on home screen is again, impossible. It has to be on springboard to run.

Zen
  • 3,047
  • 1
  • 20
  • 18
  • IMHO, "impossible" and "hacky" are two different things... I think the author knows this isn't what iOS was designed for and really isn't a great idea to do... but hey, this is StackOverflow and "not a good idea" means "it can be done" (you just really shouldn't do it) :) – JRG-Developer Jun 06 '13 at 04:52