Background GPS in iOS. Is this possible?(iOS 中的背景 GPS.这可能吗?)
问题描述
我想知道是否可以通过未运行或至少在后台运行的应用程序获取 iPhone 的位置.我想要做的是让 iPhone 在到达某个坐标时发送推送通知.这可能吗?如果是这样,有人能把我引向正确的方向吗?
I was wondering if it was possible to get the location of the iPhone with an app that isnt running, or at least running in the background. What I want to do is have the iPhone send a push notification when it arrives at a certain coordinate. Is this possible? If so, could someone put me in the right direction?
谢谢,本
推荐答案
是的,有可能.您的应用程序可以要求收到重大位置变化的通知,或者在后台执行时继续使用 GPS.前者——Apple 推荐的方法——以牺牲准确性为代价使用更少的功率 (this 博客文章表明更新精确到大约 500m),而后者是设备可以管理的准确度.这在 iOS 应用程序编程指南和和 位置感知编程指南.
Yes, it is possible. Your application can ask to be notified of significant location changes or to simply continue using the GPS while executing in the background. The former—the approach recommended by Apple—uses less power at the cost of accuracy (this blog post indicates that the updates are accurate to roughly 500m), while the latter is as accurate as the device can manage. This is all detailed in the iOS Application Programming Guide and and the Location Awareness Programming Guide.
如果您只是希望在设备移动到特定区域时通知您的应用程序,您可能需要查看 CLLocationManager
的 startMonitoringForRegion:desiredAccuracy:
.如果设备移动到特定地理区域,您的应用就会启动(即使它没有运行!).
If you simply want your application to be notified when the device moves into a particular region, you may want to look into CLLocationManager
's startMonitoringForRegion:desiredAccuracy:
. If the device moves into a particular geographical region, your app is launched (even if it's not running!).
这篇关于iOS 中的背景 GPS.这可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iOS 中的背景 GPS.这可能吗?
![](/xwassets/images/pre.png)
![](/xwassets/images/next.png)
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 拆分 Drawable 2022-01-01