3

As I understand it, my app will receive messages to the method:

- (void) locationManager:(CLLocationManager *)manager
         didUpdateToLocation:(CLLocation *)newLocation 
         fromLocation:(CLLocation *)oldLocation

even when it is in the background (if I set up it right).

What am I allowed to do in this method? I guess it is okay to store the coords etc., but can I make a server request and pass along my coordinates with it?

picknick
  • 3,897
  • 6
  • 33
  • 48

2 Answers2

0

You should be able to send a request (i.e. the OS doesn't stop you), but as you only have a limited time there's no guarantee it will get across - specially if you also need a response from the server.

mohsenr
  • 7,235
  • 3
  • 28
  • 28
  • I can ask the OS for more time right? Or is this only when i'm going into background state for the first time? – picknick Jan 20 '11 at 14:25
0

You could use the standard location service, which would also require you to declare your app as requiring nonstop background execution in the plist. This would allow your app to execute indefinitely in the background at the cost of significant power resources. You could make web service calls or provide other ways to interact with the user.

The second, and recommended approach for non navigation apps, is to use the significant-change location service which only 'wakes' up your app into the background mode when there are significant changes to the user's location. In this case, you get a finite amount of time to complete code execution and it is NOT recommended to make web service calls as they might not complete in the finite time and cause the app to be terminated by the OS.

For more information, refer to the iOS Application Programming Guide and also the Location Awareness Programming Guide

Saurabh G
  • 1,895
  • 14
  • 15