CLActivityTypeAutomotiveNavigation,CLActivityTypeFitness,CLActivityTypeOtherNavigation,
当分配给CLLocationManager的activityType属性时?
文档建议我应该根据我使用CLLocationManager的目的使用它们,但是我没有提供关于确定暂停位置更新的算法差异的提示.
从文档引用:
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.
我真的看不出这些描述之间的区别.
文档来源:
解决方法
将暂停轮询时
AutomotiveNavigation – 长时间不动.
其他导航(例如船/火车) – 长时间内移动不多.
健身 – 在较短的时间内移动不多.
其他 – 据推测不会停止投票.
理由是
>对于船只或火车,他们可能已停止,但您仍然可以在他们内部走动,所以您并不真正关心这些小更新.
>对于健身,你可能已经停止了跑步,但你仍然在你家里四处走动…你真的不想让你的电池耗尽.
其他说明
pausesLocationUpdatesAutomatically的文档进一步表明activityType仅确定是否应自动暂停位置更新.
You can help the determination of when to pause location updates by assigning a value to the activityType property.