简体   繁体   中英

Background location tracking: iOS

I'm trying to decide between Apple's significant location change services and start / stopping the location manager regularly myself. This is what Apple says about it :

Gathering location data is a power-intensive operation. It involves powering up the onboard radios and querying the available cell towers, Wi-Fi hotspots, or GPS satellites, which can take several seconds. Leaving the standard location service running for extended periods can drain the device's battery. (The significant-change location service drastically reduces battery drain by monitoring only cell tower changes, but the service works only on devices with cellular radios.) For most applications, it is usually sufficient to establish an initial position fix and then acquire updates only periodically after that . If you are sure you need regular position updates, you should use the significant-change location service where you can; otherwise, you should configure the parameters of the standard location service in a way that minimizes its impact on battery life.

So, my usecase is to be able to alert the user if they are near (~1km) a certain location. Should I just skip Significant location updates and poll the location manager every 10 minutes or so myself?

Thanks,
Teja.

Consider using the region monitoring API. It's the only way to do what you're locking for while supporting iOS 4 multitasking. Be warned, however, it's a bit temperamental, particularly if you want to monitor many regions.

I would avoid the significant location change API if you just want to know when a user is near a specific location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM