iphone - CLLocationManager geo-fencing/startMonitoringForRegion: vs. startMonitoringForSignificantLocationChanges: vs. 10-minute startUpdating calls -


i trying set app able check people's locations in background, see if @ given location, , send ping server if are. not want drain energy of our users, attempting figure out best solution.

i've done substantial reading , have not found information on these methods. i'll go through pros , cons understand them right now

startmonitoringforsignificantchanges

description: based off of wi-fi , cell tower changes system wakes app.

docs:

apps can expect notification device moves 500 meters or more previous notification. should not expect notifications more once every 5 minutes. if device able retrieve data network, location manager more deliver notifications in timely manner.

pros:

  • most battery efficient

cons:

  • dependent on wi-fi/cell tower changes
  • can assume called every 200m 2km (if not more in areas)
  • more on accuracy
  • thus, inconsistent , imprecise

10-minute start-updating or "n-minute updating":

description: asks app more time, when time expire, calls [self.locationmanager startupdating], grabs location , extends background thread 10 more minutes.

pros:

  • consistent
  • can accurate want consistently want it

cons:

  • has call every ten minutes or less keep app running in background (ie n can't greater 10 calls)

questions: effect have on battery? waking gps , shutting off hurt battery more? couldn't imagine running brief location check in background drain battery much... again, don't know goes powering gps , getting usable signal.

startmonitoringforregion (geo-fencing):

simply put, app gets woken when enter pre-defined region. oddball of them, more recent , there less documentation on it. can't find description on how "system monitors" boundary crossing. know smart algorithm, or pinging gps make less effective other methods doing this.

pros:

  • simple implementation
  • managed system don't have invent own ad hoc geo-fences triggers on boundary crossing... no unnecessary data throw out in exchange battery hit
  • thus, should best sort of thing, accurate, managed system

cons:

  • people question effectiveness
  • huge conflicts on whether or not battery life or if drains battery life terribly.
  • how system monitoring this!?
  • basically, indeterminate behavior.

i guess question boils down how startmonitoringforregion: compare these other methods of testing user location in background when comes battery life, consistency, , precision. has thoroughly tested this? or used in app , gotten @ least feedback? likely, purposes, trade-off between geo-fencing , 10 minute update method. (also given apple has publicly said ios7 there background tasks... change calculus trade-off between these 2 methods?) have idea of how these 2 compare?

thanks much! looking forward seeing if can bottom of how compare these methods.

i've been working on vehicle tracking using gps 2 years. learned lot hard way... in experience startmonitoringforregion or geo-fencing depends upon cell change events, didenter or didexit events doesn't fire until there cell/wifi change event. doesn't make difference w.r.t battery consumption. computation depends on how many regions being monitored. apple's reminder app doesn't give results location based reminders because uses geo-fencing.

the other approach starting gps n minutes after each m-minutes option, should not affect battery life, if done wisely. effect battery constant gps activation in high precision mode. instance if enable gps kcllocationaccuracybest , distance-filter = 0, can literally observe battery drainage , device start getting hotter.

if you, go activating gps after every 10 minutes 5 sec kcllocationaccuracybest (or may kcllocationaccuracynearesttenmeters use less battery, if accuracy not important) , distance-filter = 5 (meters). battery consumption in case unnoticeable. can play around similar settings can address specific case , find out best you.

btw: iphone uses agps, a-gps additionally uses network resources locate , use satellites in poor signal conditions. so, when startupdatinglocation use nearby cell tower information. see http://en.wikipedia.org/wiki/assisted_gps


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -