【问题标题】:How to detect iBeacons without know UUID,Any Possible to get core bluetooth or Some other way如何在不知道 UUID、任何可能获得核心蓝牙或其他方式的情况下检测 iBeacons
【发布时间】:2018-01-30 07:09:36
【问题描述】:

是否可以在不知道其 UUID 的情况下检测 iBeacons? 有什么方法可以使用 Core Bluetooth 或其他方法吗?

【问题讨论】:

  • 这个问题似乎太窄了。

标签: ios iphone ibeacon core-bluetooth


【解决方案1】:

您必须至少知道要查找的 UUID 才能创建 CLBeaconRegion。 iOS 上无法扫描“所有信标”。

iBeacons 被 Core Bluetooth 发现特别遮挡。

【讨论】:

    【解决方案2】:

    虽然如果不预先指定 ProximityUUID 就无法在 iOS 上检测信标,但您可以设置范围以查找大量 ProximityUUID——我已经成功地同时针对其中的 100 个进行了范围(尽管 1000 次使我的应用程序崩溃) .)

    通过使用在线信标数据库,您可以找到已知与您关系密切的 UUID 列表。这不会确定检测到每个信标,但它可以让您检测周围的许多信标,而无需将 UUID 构建到您的应用中。

    这是一个使用NingoSDK 获取距离您的位置最近的 100 个 ProximityUUID 并注册它们以进行测距的示例。

    let locationManager = CLLocationManager()
    // Get up to 100 beacon ProximityUUIDs within 1km from our current location, so we can use these for beacon ranging
    let queryClient = QueryBeaconClient(authToken: Settings().getSetting(key: Settings.ningoReadonlyApiTokenKey)!)
    queryClient.queryFirstIdentifiers(latitude: latitude, longitude: longitude, radiusMeters: 1000, limit: 100) { (proximityUUIDStrings, errorCode, errorDetail) in
        if let proximityUUIDStrings = proximityUUIDStrings {
            NSLog("There are now \(proximityUUIDStrings.count) nearby beacon uuids")
            if proximityUUIDStrings.count > 0 {
                for region in locationManager.rangedRegions {
                    locationManager.stopRangingBeacons(in: region as! CLBeaconRegion)
                }
                for uuidString in proximityUUIDStrings {
                    let region = CLBeaconRegion(proximityUUID: UUID(uuidString: uuidString)!, identifier: uuidString)
                    locationManager.startRangingBeacons(in: region)
                }
                BeaconTracker.shared.updateTransientUuids(uuids: proximityUUIDStrings)
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2020-05-27
      • 2018-09-29
      • 2017-06-27
      • 2016-09-06
      • 1970-01-01
      • 1970-01-01
      • 2011-05-01
      • 1970-01-01
      • 2014-03-15
      相关资源
      最近更新 更多