小编mao*_*yue的帖子

android BluetoothDevice.getName()返回null

有时,BluetoothDevice.getName()返回null.我该如何解决?remoteDeviceName在以下代码中可能为null.我需要通过remoteDeviceName来区分我的设备和其他设备.

BluetoothAdapter.getDefaultAdapter().startLeScan(new LeScanCallback() {
            @Override
            public void onLeScan(final BluetoothDevice device, final int rssi,
                    byte[] scanRecord) {
                    String remoteDeviceName = device.getName();
                  Log.d("Scanning", "scan device " + remoteDeviceName);
            });
Run Code Online (Sandbox Code Playgroud)

null android bluetooth device network-scan

13
推荐指数
2
解决办法
2万
查看次数

标签 统计

android ×1

bluetooth ×1

device ×1

network-scan ×1

null ×1