How can I reconnect to device after disconnecting in Core Bluetooth

前端 未结 4 502
甜味超标
甜味超标 2021-02-03 13:42

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条回答
  •  猫巷女王i
    2021-02-03 14:16

    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.

提交回复
热议问题