开发者

Running application in background like google latitude

I'm working nowadays on an application that tracking the user location. I want this application to run even when it's not in the task list (double click on the home button doesn't show it). Like google latitude, the application is not running in background. I think that this document is talking about running application when user press on the home button: http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/BackgroundExecution/BackgroundExecution.html

but what if user close this application by double clic开发者_开发问答k on the home button? I know that applications like google latitudes are still running in the background. so how can I do that?


Application is able to run again in background in case if it was registered for significant location change when launched last time. If Google latitude launch application back, than they use this flow:

  1. Application launch
  2. Check if device can provide significant location change notification (devices with cellular data may handle this kind of notification): significantLocationChangeMonitoringAvailable
  3. Register for notification: startMonitoringSignificantLocationChanges
  4. Quit app and as soon as your device will leave one cell tower to another, system would send notification and your application will be waked up.

There is a problem, no normal way to unregister from this notification. I think only by providing user an option to stop monitoring. I noticed this, by arrow on top right corner of status bar, which means what someone is using location service.


I can assure you that Google Latitude only updates the user's location when it's being run (and visible) or when it is running as a background process (when multitasking is available).

Google latitude is using the location background service which uses cell towers to determine the location of the device when the app is running on the background (as described on the documentation you linked). There is no way the Latitude app can update the location if it's not a running process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜