Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS background application network access

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?

like image 939
michael Avatar asked Mar 08 '12 05:03

michael


2 Answers

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.

like image 135
bontoJR Avatar answered Sep 21 '22 01:09

bontoJR


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.

like image 36
HelmiB Avatar answered Sep 21 '22 01:09

HelmiB