【发布时间】:2016-08-28 04:59:01
【问题描述】:
这是我的扫描仪回调代码。
private BluetoothAdapter.LeScanCallback mLeScanCallback =
new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (device == null) {
return;
}
if (!device.getName().startsWith("DEVICE_NAME")) {
System.out.println("Did not start with DEVICE_NAME, removing: " + device.getName());
return;
}
if (!devices.contains(device)) {
System.out.println("Valid DEVICE_NAME Adding: " + device.getName());
devices.add(device);
}
}
});
}
};
当我在某些地理位置进行扫描时,我得到一个空的 BluetoothDevice 对象。例如,它在我的家中或工作地点工作得非常好。
但是,如果我将我的硬件 + 电话带到机场或大型万豪酒店,那么它会搞砸并返回一个 null BluetoothDevice。
空设备是什么意思,我该如何解决这个问题?
任何建议将不胜感激。
问候
【问题讨论】:
标签: android bluetooth-lowenergy