How can I reconnect to device after disconnecting in Core Bluetooth

前端 未结 4 1909
庸人自扰
庸人自扰 2021-02-03 13:40

In Core Bluetooth, after connecting to a device, I turn off the device and the device is disconnected. But when I turn on the device again, there is no didDiscoverPeripher

4条回答
  •  广开言路
    2021-02-03 14:06

    In CoreBluetooth all management is done by application layer. In your case, what I would do it is to listen for disconnect event than in same event, reconnect the peripheral. The connection method is an inexpensive one and assure you to reconnect to your device when it is back in range.

    Note that if you explicitly disconnect the device, you received the same disconnect event, but you haven't to call the reconnect method.

提交回复
热议问题