Eyal
Eyal

Reputation: 10828

objective c - significant location changes

I'm building a client-server app, and I need that the server will always know what is the current client location.
So when the client app is active I use CLLocationManager to get the client location every 10 minutes and send it to the server.
My problem is what to do when the app is close? I know I can use significant location changes to get location updates when the app is close, but can I send this location updates to my server without launching the app? I mean when the app is close I want it to be transparent to the user, Is this possible? Does something happen with the UI when I get one of this location updates?

Upvotes: 1

Views: 2563

Answers (1)

Ravin
Ravin

Reputation: 8564

In documentation, they say

the system automatically relaunches the application into the background if a new event arrives, In such a case, the options dictionary passed to the application:didFinishLaunchingWithOptions: method of your application delegate contains the key UIApplicationLaunchOptionsLocationKey to indicate that your application was launched because of a location event.

Upon relaunch, you must still configure a location manager object and call this method to continue receiving location events. When you restart location services, the current event is delivered to your delegate immediately. In addition, the location property of your location manager object is populated with the most recent location object even before you start location services

You can send the location to server without showing any UI element.

Upvotes: 1

Related Questions