BluetoothDevice.getUuids()方法返回null
创始人
2024-12-23 03:00:22
0

在调用 getUuids() 方法之前,需要先调用 fetchUuidsWithSdp() 方法来获取设备的 UUID 列表。示例代码如下:

BluetoothDevice device = ...; BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();

// 发送服务搜索请求,获取设备的 UUID 列表 device.fetchUuidsWithSdp();

// 等待一段时间,等待设备响应服务搜索请求 try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); }

// 获取设备的 UUID 列表 ParcelUuid[] uuids = device.getUuids(); if (uuids != null) { for (ParcelUuid uuid : uuids) { Log.d(TAG, "Device UUID: " + uuid.toString()); } } else { Log.d(TAG, "Device UUIDs are null."); }

需要注意的是,fetchUuidsWithSdp() 方法会发送一个服务搜索请求到设备,该请求需要一定时间才能得到响应。因此,在调用 getUuids() 方法之前,需要等待一段时间让设备响应服务搜索请求。通常情况下,等待时间为 1 秒左右就可以得到设备的 UUID 列表。

相关内容

热门资讯

透视苹果版(德扑数据软件)德州... 透视苹果版(德扑数据软件)德州辅助软件线上(详细辅助安装教程)原先是真的有挂1.德扑数据软件 ai辅...
透视新版(wepOKE)透明挂... 透视新版(wepOKE)透明挂辅助安装(WePoKe透明挂)原来有挂(详细透视切实教程);支持多人共...
透视好友(wePokE)外挂透... 透视好友(wePokE)外挂透明挂辅助app(wepoke模拟器)好像真的是有挂(详细透视必赢方法)...
透视神器(aapoker辅助工... 透视神器(aapoker辅助工具)德扑牌型胜率(详细辅助高科技教程)好像存在有挂1.aapoker辅...
透视了解(wePoke)透视辅... 透视了解(wePoke)透视辅助神器(wepoke辅助)一向是真的有挂(详细透视透明教程)这是由厦门...
透视ai(wpk透视辅助测试)... 透视ai(wpk透视辅助测试)wepoke辅助(详细辅助辅助教程)往昔是有挂您好,wpk透视辅助测试...
透视脚本(wepOkE)透视辅... 1、透视脚本(wepOkE)透视辅助挂(WePoKe透视挂)其实是有挂(详细透视细节方法)2、进入游...
透视脚本(德州之星有辅助挂)p... 透视脚本(德州之星有辅助挂)pokermaster有外挂吗(详细辅助技巧教程)原先是有挂1.德州之星...
透视app(wEpoke)透视... 透视app(wEpoke)透视辅助挂(WePoKe外挂)总是有挂(详细透视德州教程);玩家必备必赢加...
透视智能ai(wepoke有辅... 透视智能ai(wepoke有辅助挂)红龙扑克发牌有问题(详细辅助wpk教程)好像存在有挂1、这是跨平...