How to reliably get location on iPhone

I am working on an application using iPhone GPS to get location track. To save energy, I want to get location data while the screen is off. I learned how to play a quiet audio file to keep the location capture in standby mode. I still have occasional problems stopping location capture in sleep mode. This happens, perhaps, in 5-10% of cases. I suspect that perhaps I may not have a good enough correction of the location, although the appearance of the current location annotation on the view map seems to imply a good and accurate correction. Does anyone know a good way to definitively determine that a location manager has a good solution? Does anyone know any tricks for kicking a sleep location manager,to save it? I tried to start a 30 second recurring timer and read the current location every time I started it. Unfortunately, this did not help. Any suggestions are welcome.

- rich

+3
source share
1 answer

You can check the returned data from the location manager for the property horizontalAccuracyto make sure the location is accurate enough or not.

Another way to turn off the display and save battery power without tricks is to turn on the proximity sensor and turn off sleep. Thus, the display will be blank when the phone is in your pocket, and will light up when you pick it up to look at it.

+2
source

Source: https://habr.com/ru/post/1730894/


All Articles