gpt4 book ai didi

ios - 打电话时获取用户位置

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:44:42 24 4
gpt4 key购买 nike

我需要在调用电话号码时在后台获取准确位置(尽可能准确)(该电话将从应用程序调用)。据我从文档中了解到,我可以听到背景位置的重大变化。我想知道重大更新的准确性如何以及何时触发。

我需要调用电话的位置,因为这是紧急电话。在前台收听位置然后调用电话不是一个好主意,因为这将是紧急情况 - 将立即调用电话。

是否有解决方案可以在后台获取用户的准确位置?你有什么建议?

编辑:位置将立即发送到服务器。

最佳答案

至于准确度,可以在后台获取准确位置,下那些conditions :

Getting Location Events in the Background

If your application needs location updates delivered whether the application is in the foreground or background, there are multiple options for doing so. The preferred option is to use the significant location change service to wake your application at appropriate times to handle new events. However, if your application needs to use the standard location service, you can declare your application as needing background location services.

An application should request background location services only if the absence of those services would impair its ability to operate. In addition, any application that requests background location services should use those services to provide a tangible benefit to the user. For example, a turn-by-turn navigation application would be a likely candidate for background location services because of its need to track the user’s position and report when it is time to make the next turn.

至于在通话期间获取位置,我自己没有使用它,但是像'waze这样的导航应用程序。 ' 请在电话中通知转弯和导航事件,所以我猜你问的是可能的。

如果我了解您的需求,您有 2 个选择:

  1. 如果您认为用户将是静态的,那么只需在调用之前获取用户位置即可。或者更好的是,当您的应用正在午餐时间调用紧急电话时。

  2. 如果用户正在移动,那么您可以“请求”获取背景位置事件。 即便如此,您也应该考虑使用“显着变化位置服务”,因为您不需要比用户位置更多的信息。标准的“位置服务”用于导航“转弯”服务。

*最后评论 *

如果您的应用程序是应急应用程序,您应该阅读上一个链接中的“节省电池电量的提示”。您不希望您的用户电池在跟踪他的位置时耗尽。

关于ios - 打电话时获取用户位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12243639/

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