【问题标题】:CoreBluetooth: Range Detection in Background modeCoreBluetooth:后台模式下的范围检测
【发布时间】:2014-03-30 04:10:55
【问题描述】:

我正在开发一个与外围设备连接并需要观察其状态的应用程序。

当应用程序处于前台时,范围检测没有问题:我只是不时更新RSSI值并将其转换为范围。

现在我想使用带有 CoreBluetooth 背景模式的应用程序。我想在设备超出特定范围时向用户发送通知。

我怎样才能实现这种行为?

【问题讨论】:

    标签: ios objective-c cocoa-touch bluetooth-lowenergy core-bluetooth


    【解决方案1】:

    您可以在您的应用程序在application didFinishLaunchingWithOptions: 上启动后立即从 AppDelegate.m 开始测距外围设备,将委托设置为 self,并使用 UILocalNotification 通知自己。

    有一个使用CoreLocation而不是CoreBluetoothhere的例子。

    不要忘记修改您的 info.Plist 以在后台模式下进行通信。

    【讨论】:

    • 该代码示例使用“didDetermineState”来检测设备何时退出该区域。 corebluetooth有类似的后台回调吗?我还没找到。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-14
    相关资源
    最近更新 更多