ios - 信标测距与 BLE 扫描

标签 ios bluetooth bluetooth-lowenergy ibeacon beacon

我试图了解信标测距和 BLE 扫描之间的区别。据我了解,信标测距使用 BLE 扫描来查找信标。最重要的是,它使用信号强度(我不需要)计算信标的接近度。我只需要检测信标(类似于信标监控)。由于 IOS 中的 Always 权限要求,我没有使用信标监控。我知道与测距相比,信标监控是高度优化的,但我想知道测距与 BLE 扫描相比如何。

  • 我可以使用 BLEModule.scanForDevices(UUID) 代替 CLLocationManager.startRangingBeacons(region) 来检测信标吗?如果是,我能否在检测到信标时以类似方式获得回调?

  • 这样做在电池性能或检测时间等方面是否有任何缺点?

    请注意,我愿意在没有邻近信息(与信标的距离)的情况下凑合。

还有一个相关的问题:

  • 信标监控是否可以在 iOS 中使用 WhenInUse 权限在前台使用?(我在初步调查中发现对此有不同的看法)

最佳答案

您无法使用 Core 蓝牙扫描来检测 iBeacon。您必须使用 Core Location 并监控 CLBeaconRegion 才能发现 iBeacons。

发现信标后,您无需对其进行测距。

Apple's documentation 中所述

Important

Apps must have always authorization to use region monitoring, and they must be configured with the Location updates background mode to be launched.

即使您只想在应用位于前台时收到信标通知,您也必须始终请求权限。

关于ios - 信标测距与 BLE 扫描,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55491956/

相关文章:

c++ - 在 Linux 上使用 C++ 访问 Sony Playstation SixAxis Controller

ios - 当我点击 MapKit 中的图钉时如何执行操作? ios9, swift 2

php - swift 3.0 中的播放器 ID 格式问题

iOS WKWebview loadHTMLString(_ baseURL :) fails to load images and read css

bluetooth-lowenergy - Watch OS 2 native 应用程序蓝牙设备连接

Android (Things) GATT 服务器停止广告

android - "Bluetooth Share has stopped"在 Android 上检测 iBeacons 时发出警报

php - 从 ios Web 服务登录 android?

Android.bluetooth.IBluetooth.createBond() 未在 4.2.1 中找到,但适用于早期操作系统版本

android - 基于接近度的遥控 key 安全设备,带蓝牙 : how it works