开发者

Time Out period for Core Location to work properly

I'm using core location to identify the user's location via iphone. Now when the application starts and i go [locationManager startUpdatingLocation], an alertbox is shown with text "App would like to use your current location". Ideally I'd want to start a time out nstimer when the user presses OK on this alert box. Apparently there's no way to capture the alertbox response so what I do is start a timer as soon as t开发者_JAVA百科he application starts with a timeout time of 10s. Of course this means that if the user does not press the buttons on the alertbox just in time, the timer will time out and that'll be the end of the location process right there. The reason for the time out timer is that at times the app takes rather longer time periods to identify the users location, even under a clear sky.

So i guess what I'm asking is what should be the ideal time out period for the core location services given that the timer and the location service both start when the application starts?


It's hard to give a general advice here because it really depends on what accuracy and freshness of the data you want. Generally, you'll receive multiple Core Location updates of different age and accuracy. Normally, you'll receive an old, cached location first. Then you'll receive updates based on WiFi and cell tower triangulation. GPS updates takes the longest time and are dependent on clear sky. So if you're fine with a cached location update with cell tower accuracy (~3 km), then you normally don't have to wait for a long time. A 20 second time out should be absolutely fine. Of course, things are different if you wanna cover the "No Carrier" case and thus are dependent on GPS.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜