[英]Android how to get data sent by ble device
scanResult.getScanRecord()
How to get the data sent from the scan record object i am setting data like this如何获取从扫描记录对象发送的数据我正在设置这样的数据
String tosendData = "testdata"; // less than 31 bytes
dataBuilder.addServiceData(Service_UUID, tosendData.getBytes());
private String getAdviData(ScanRecord scanRecord){
try {
return new String( scanRecord.getBytes(), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return "error";
}
}
You just parse the array Bytes from the scan record to the data you send.您只需将数组 Bytes 从扫描记录解析为您发送的数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.