13

I have an application that requires location tracking and I think it fits squarely within one of the allowable background models. However, I need to post to a network service when there are significant changes of location. I've seen write-ups that state network access is prohibited in background processing, but I didn't read that in Apple's docs.

Does anyone know if it's kosher (wrt Apple policies) to make occasional and very quick network updates in a background process?

michael
  • 241
  • 1
  • 5
  • 12

3 Answers3

12

Good point, according to the Apple documentation only the following usages are allowed in background and each service should be registered:

  • audio—The app plays audible content to the user while in the background. (This content includes streaming audio or video content using AirPlay.)
  • location—The app keeps users informed of their location, even while it is running in the background.
  • voip—The app provides the ability for the user to make phone calls using an Internet connection.
  • newsstand-content—The app is a Newsstand app that downloads and processes magazine or newspaper content in the background.
  • external-accessory—The app works with a hardware accessory that needs to deliver updates on a regular schedule through the External Accessory framework.
  • bluetooth-central—The app works with a Bluetooth accessory that needs to deliver updates on a regular schedule through the CoreBluetooth framework.

Other than this services, you can create a Finite-Length Task in the Background that actually give you the possibility to end a network process.

This can be important if your app is performing some important task, such as writing user data to disk or downloading an important file from a network server.

Regarding your question, it's not really clear if you can or not can do a quick network connection if you've a location service running in background. I would say YES for a short connection, but not totally sure. Since iOS 4.0 this usage was denied and clear in documentation, now that part has been removed.

CodeBender
  • 35,668
  • 12
  • 125
  • 132
bontoJR
  • 6,995
  • 1
  • 26
  • 40
2

Yes if you use background for just quick connection. Apple won't allow you to run in the background as you want.

NO If your app does not fall in the Voip, music or GPS category; then you can't run in background.

more here: Update my app when it is in background


You could use ASIHTTPRequest.

ASIHTTPRequest has a property setShouldContinueWhenAppEntersBackground:. default is NO, you may turn on YES so you have background network process.

Community
  • 1
  • 1
HelmiB
  • 12,303
  • 5
  • 41
  • 68
  • Thx. To clarify, the question is really whether Apple allows network access when running in background. – michael Mar 08 '12 at 07:54
  • Thx again, but the link doesn't really answer my question - that's more about finishing an existing network request. I want to run indefinitely in the background and do the occasional network request (let's say send 1000 bytes hourly). It's a question of Apple policy around *network* access in background apps. – michael Mar 08 '12 at 17:17
  • well then, answer would be NO. apple won't allow you to do that (if possible). – HelmiB Mar 09 '12 at 00:50
  • Can you point me to anything written from Apple or someone who has had an app rejected for this? This is hugely important to me, so I need to know for certain whether yes or no. – michael Mar 09 '12 at 17:27
  • it's possible to do. try to look other implementation like `ASIHTTPRequest`. – HelmiB Nov 08 '12 at 02:31
1

Apple documentation seems a bit unclear on the strict policy. There are definitely applications in the app store that make sporadic network calls while running in the background as a location-based application. An example is the Geoloqi application.

x89a10
  • 681
  • 1
  • 8
  • 23