Android Bluetooth:FetchUUIDSWithDP()不会返回某些设备上的所有UUID

Android Bluetooth:FetchUUIDSWithDP()不会返回某些设备上的所有UUID,android,bluetooth,android-bluetooth,Android,Bluetooth,Android Bluetooth,我有两个不同的蓝牙应用程序。第一个提供服务并侦听来自其他commander应用程序的命令。我有一部GT-I9100T手机和一台GT-P5210平板电脑。平板电脑在监听时工作正常,手机可以看到我的应用程序的UUID。但是当我以侦听器的身份运行电话时,侦听器的UUID没有列出 我根据我的应用程序UUID过滤设备,这样我就知道我只与那些运行应用程序的设备通话 我的听力应用程序如下所示(如果使用不安全的连接,我也会得到相同的结果): 我的commander应用程序MainActivity如下所示: pr

我有两个不同的蓝牙应用程序。第一个提供服务并侦听来自其他commander应用程序的命令。我有一部GT-I9100T手机和一台GT-P5210平板电脑。平板电脑在监听时工作正常,手机可以看到我的应用程序的UUID。但是当我以侦听器的身份运行电话时,侦听器的UUID没有列出

我根据我的应用程序UUID过滤设备,这样我就知道我只与那些运行应用程序的设备通话

我的听力应用程序如下所示(如果使用不安全的连接,我也会得到相同的结果):

我的commander应用程序MainActivity如下所示:

private final BroadcastReceiver mReceiver = new BroadcastReceiver() {

    @Override
    public void onReceive(Context context, Intent intent) {
        final String action = intent.getAction();
        Log.i(TAG,"Action received: "+action);
        if(action.equals(BluetoothDevice.ACTION_UUID)) {
             BluetoothDevice btd = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
             Log.i(TAG,"Received uuids for "+btd.getName());
             Parcelable[] uuidExtra = intent.getParcelableArrayExtra(BluetoothDevice.EXTRA_UUID);
             StringBuilder sb = new StringBuilder();
             List<String> uuids = new ArrayList<String>(uuidExtra.length);
             if(uuidExtra != null) {
                 for (int i = 0; i < uuidExtra.length; i++) {
                    sb.append(uuidExtra[i].toString()).append(',');
                    uuids.add(uuidExtra[i].toString());
                 }
             }
             Log.i(TAG,"ACTION_UUID received for "+btd.getName()+" uuids: "+sb.toString());
             ListContent.addItemWithUUIDs(btd, uuids);
        }
    }
}
将平板电脑用作指挥官,手机用作侦听器时的logcat输出:

DeviceListActivity(29524): Received uuids for GT-I9100T
DeviceListActivity(29524): ACTION_UUID received for GT-I9100T uuids:
0000110a-0000-1000-8000-00805f9b34fb,
00001105-0000-1000-8000-00805f9b34fb,
00001116-0000-1000-8000-00805f9b34fb,
0000112d-0000-1000-8000-00805f9b34fb,
0000112f-0000-1000-8000-00805f9b34fb,
00001112-0000-1000-8000-00805f9b34fb,
0000111f-0000-1000-8000-00805f9b34fb,
00001132-0000-1000-8000-00805f9b34fb,
DeviceListActivity(23121): Received uuids for GT-P5210
DeviceListActivity(23121): ACTION_UUID received for GT-P5210 uuids:
00001105-0000-1000-8000-00805f9b34fb,
0000110a-0000-1000-8000-00805f9b34fb,
0000110c-0000-1000-8000-00805f9b34fb,
00001112-0000-1000-8000-00805f9b34fb,
00001115-0000-1000-8000-00805f9b34fb,
0000111f-0000-1000-8000-00805f9b34fb,
00001200-0000-1000-8000-00805f9b34fb,
3def793a-fa94-4478-ae56-108854b1ef4b,
我使用手机作为指挥官,平板电脑作为监听器,获得了正确的输出:

DeviceListActivity(29524): Received uuids for GT-I9100T
DeviceListActivity(29524): ACTION_UUID received for GT-I9100T uuids:
0000110a-0000-1000-8000-00805f9b34fb,
00001105-0000-1000-8000-00805f9b34fb,
00001116-0000-1000-8000-00805f9b34fb,
0000112d-0000-1000-8000-00805f9b34fb,
0000112f-0000-1000-8000-00805f9b34fb,
00001112-0000-1000-8000-00805f9b34fb,
0000111f-0000-1000-8000-00805f9b34fb,
00001132-0000-1000-8000-00805f9b34fb,
DeviceListActivity(23121): Received uuids for GT-P5210
DeviceListActivity(23121): ACTION_UUID received for GT-P5210 uuids:
00001105-0000-1000-8000-00805f9b34fb,
0000110a-0000-1000-8000-00805f9b34fb,
0000110c-0000-1000-8000-00805f9b34fb,
00001112-0000-1000-8000-00805f9b34fb,
00001115-0000-1000-8000-00805f9b34fb,
0000111f-0000-1000-8000-00805f9b34fb,
00001200-0000-1000-8000-00805f9b34fb,
3def793a-fa94-4478-ae56-108854b1ef4b,
如您所见,my app的GUID列为最后一项。我已经尝试过让这些设备可以被发现,并进行绑定和解除绑定,但我的应用程序的GUID从未在手机上返回。我还有其他非Android设备也使用这个GUID,它们也会被正常发现


手机运行4.1.2,平板电脑运行4.2.2

您找到解决方案了吗?我也有同样的问题,但我的桌面广告。我没有找到解决方案。您所能做的最好的事情就是尝试使用GUID进行连接,并查看它是否成功连接。同样的问题。。。。。。。如果有人知道怎么做……你能想出来吗?目前正在努力解决同样的问题。@dustedrob我从未解决过这个问题。我想这是固件中的一个bug。我之前的评论有一个潜在的解决方案。
DeviceListActivity(23121): Received uuids for GT-P5210
DeviceListActivity(23121): ACTION_UUID received for GT-P5210 uuids:
00001105-0000-1000-8000-00805f9b34fb,
0000110a-0000-1000-8000-00805f9b34fb,
0000110c-0000-1000-8000-00805f9b34fb,
00001112-0000-1000-8000-00805f9b34fb,
00001115-0000-1000-8000-00805f9b34fb,
0000111f-0000-1000-8000-00805f9b34fb,
00001200-0000-1000-8000-00805f9b34fb,
3def793a-fa94-4478-ae56-108854b1ef4b,