【发布时间】:2018-02-14 19:00:00
【问题描述】:
我目前有一个设备与我的智能手机(Micro:Bit BBC)配对。我的应用必须连接到它,重新连接以防它失去连接并读取此设备提供的一个特征。
我是 Android 新手。我已经阅读了此链接Android BLE SDK,但我无法理解所有内容,并且该代码中的某些部分丢失了。
我知道如何查找配对设备,但不知道之后该怎么做:
bleAdapter = ((BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
Set<BluetoothDevice> pairedDevices = bleAdapter.getBondedDevices();
这向我展示了绑定的唯一设备(BBC micro:bit [zogav])。如果 micro:bit 超出范围,我如何连接到该设备、保持连接并重新连接?
【问题讨论】:
-
keep the connection alive是什么意思? -
我的意思是我的智能手机订阅了一个特性并重新连接到 micro:bit,以防连接丢失。
标签: android bluetooth bluetooth-lowenergy