gpt4 book ai didi

ios - 如何在用户不移动时自动暂停 GPS 跟踪器

转载 作者:行者123 更新时间:2023-11-28 14:48:36 28 4
gpt4 key购买 nike

我有一个分为两部分的问题 (1) 如何在用户不移动时暂停事件跟踪,(2) 这可以节省电池生命周期吗?

更多信息。我正在构建一个事件跟踪器,但用于通常涉及大量暂停的事件 - 例如。步行30分钟,在一个位置等待60-120分钟,然后再步行30分钟等。

由于整体跟踪最多可能需要 3-4 小时,因此尽可能减少电池消耗会很有用。当用户在给定位置停留较长时间时,由于 GPS 不准确,事件的折线不包括大量来回也是很好的。

回到问题。 (1) 如何使用 swift 识别用户何时静止不动,并暂停折线跟踪 (2) 这会节省电池生命周期吗?

最佳答案

您应该查看 startMonitoringSignificantLocationChanges() ( documentation here )。

上述链接中的描述似乎符合您的需要:

After returning a current location fix, the receiver generates update events only when a significant change in the user’s location is detected.

您可能还希望包括此检查以确保您可以使用上述功能:

significantLocationChangeMonitoringAvailable()

Returns a Boolean value indicating whether the significant-change location service is available.

关于ios - 如何在用户不移动时自动暂停 GPS 跟踪器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50065470/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com