![](/img/trans.png)
[英]Get Bluetooth device information from the Android bluetooth device picker
[英]Android bluetooth get response with BluetoothGatt
我是連接藍牙的新手。 我使用https://github.com/Fakher-Hakim/android-BluetoothLeGatt的代碼。 當我嘗試獲取信息時,什么也沒發生。
public String response() {
if (mConnected) {
mBluetoothLeService.readCharacteristic(characteristica);
byte response[] = characteristica.getValue();
String respuesta = ReadBytes(response);
mBluetoothLeService.disconnect();
return respuesta;
} else {
return null;
}
}
我執行功能后
private final ExpandableListView.OnChildClickListener servicesListClickListner
如何獲取藍牙設備的信息?
BLE操作是異步的,您必須在回調中處理結果。 在您的示例中: https : //github.com/Fakher-Hakim/android-BluetoothLeGatt/blob/master/Application/src/main/java/com/example/android/bluetoothlegatt/BluetoothLeService.java
檢查onCharacteristicRead方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.