UUID无法在android api 23及更高版本中运行,解决方案是什么

时间:2018-01-30 07:59:48

标签: android bluetooth

这在api低于23但是在23以及更高的时候工作得很好我也试过了; 这是一个基本的UUID;

private static final UUID MY_UUID_INSECURE = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");

通过创建不安全的蓝牙套接字:

mBluetoothServerSocket = mBlurtoothSocket.createInsecureRfcommSocketToServiceRecord(My_UUID_INSECURE);

这也给出了相同的结果。我还尝试了创建RFcomm的蓝牙插座:

mBluetoothServerSocket = mBlurtoothSocket.createRfcommSocketToServiceRecord(My_UUID_INSECURE);`

使用wifiManager获取设备的mac地址:

WifiManager manager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
WifiInfo info = manager.getConnectionInfo();
String address = info.getMacAddress();

尝试将Mac地址转换为UUID,但这会产生无效的mac地址

My_UUID_INSECURE = UUID.fromString(address);

0 个答案:

没有答案