I want to make an app that sends current GPS location to the server. This app also needs to work in background mode. Is it possible to make this kind of app?
Asked
Active
Viewed 697 times
-1
-
1StackOverflow is not a coding service. If you have a specific question, please ask that. See [What topics can I ask about here?](http://stackoverflow.com/help/on-topic) and [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask). – Celeo Oct 14 '14 at 18:34
1 Answers
1
Yes, that's indeed possible. You have to use the Core Location
API for that.
Background code execution on iOS is quite tricky in general, but location updates are actually one of the few cases which make this possible. Your app receives the right to perform some operations after location updates are received, so you can use these operations to send the new data to the server.

nburk
- 22,409
- 18
- 87
- 132
-
-
-
-
Well, that's quite complicated, take a look at this article for some guidance: http://www.objc.io/issue-5/multitasking.html And here is the development guide for background execution: https://developer.apple.com/library/ios/documentation/iphone/conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html – nburk Oct 14 '14 at 18:54
-
open GPS in background is forbidden in Apple's document, but if your app is relaunched by significant location change, you can still quick call `startUpdateLocation` to get GPS updates, and don't forget to call `stopUpdateLocation` after. This is confirmed by a Apple engineer during WWDC14. – coolbeet Oct 14 '14 at 19:07