Difference between CLActivityType values

What is the difference between those values:

CLActivityTypeAutomotiveNavigation,
CLActivityTypeFitness,
CLActivityTypeOtherNavigation,

When assigned to activityType property of CLLocationManager ?

Documentation suggest that I should use them according to my purpose of using CLLocationManager, but I gives no hint about difference in algorithm that determine halting location updates.

Quote from documentation:

CLActivityTypeAutomotiveNavigation

[...] This activity might cause location updates to be paused only when the vehicle does not move for an extended period of time.

CLActivityTypeFitness

[...]This activity might cause location updates to be paused only when the user does not move a significant distance over a period of time.

CLActivityTypeOtherNavigation

This activity might cause location updates to be paused only when the vehicle does not move a significant distance over a period of time.

I really cannot see the difference between those descriptions.

Documentation Source:

https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/#//apple_ref/c/econst/CLActivityTypeOther


It seems activityType only affects battery performance while monitoring location. Specifically when it pauses polling location.

Will pause polling when

AutomotiveNavigation - Not moved at all in a long time.

OtherNavigation (eg boat / train) - Not moved much in a long time.

Fitness - Not moved much in a shorter period of time.

Other - Presumably will not stop polling.

Reason being

  • For boats or trains they may have stopped, but you could still be walking around inside them so you don't really care about these small updates.

  • For fitness you might have stopped your run but you are still moving around in your house... You don't really want to keep draining your battery.

  • Other notes

    The docs for pausesLocationUpdatesAutomatically further suggest that the activityType only determines if location updates should be automatically paused.

    You can help the determination of when to pause location updates by assigning a value to the activityType property.


    Not only does the activityType affect battery life as specified by Robert's answer and Apple official documentation, it might also affect the way in which the coordinates returned might be "snapped" to the closest road under certain conditions.

    In short, if you're not using activity type "Other Navigation", and if the location is changing fast (= you're on a vehicle fast enough), and somehow your phone is able to get the information needed through Internet or a local cache, the locations reported by the manager will not be accurate, as they'll be "snapped" to the closest road.

    This issue has been reported for all versions of iOS since iOS 6. And the issue seems to appear also if any instance of the locations manager running on the entire system has been set up with an activity type that is not "other navigation": note that the default for that property is "other", which is not the same as "other navigation".

    Some references:

  • another post on stackoverflow: Control iOS gps input
  • a blog post: http://regex.info/blog/2016-01-19/2666
  • one openradar issue with no answer: https://openradar.appspot.com/radar?id=6056041628303360
  • and another one: http://openradar.appspot.com/radar?id=2245401
  • 链接地址: http://www.djcxy.com/p/29720.html

    上一篇: Windows 10 Home上是否有适用于Visual Studio的替代Android模拟器?

    下一篇: CLActivityType值之间的差异