连接到不可发现的蓝牙设备

时间:2010-10-13 10:56:22

标签: android java-me bluetooth

我正在为Android开发一个应用程序。只是一般性问题,是否可以连接到公开不可发现的设备?

提前致谢。

3 个答案:

答案 0 :(得分:6)

如果您之前已与设备配对,则即使它未处于可发现模式,也可以再次连接到该设备。看这篇文章: programmatically-connect-to-paired-bluetooth-device

    // use paired devices or create a BluetoothDevice using a mac address
    //Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
    BluetoothAdapter myAdapter = BluetoothAdapter.getDefaultAdapter();
    BluetoothDevice remoteDevice = myAdapter.getRemoteDevice("00:00:00:00:00:00");
    BluetoothSockt btSocket = remoteDevice.createRfcommSocketToServiceRecord(UUID);
    btSocket.connect();
    //get input and output stream etc...

答案 1 :(得分:3)

通过发现我认为你的意思是回应来自其他设备的设备搜索。一些制造商也将其称为可见。 根据设备的制造商,某些设备允许打开蓝牙并将可见性/发现能力设置为关闭。 因此,如果您已经知道设备的蓝牙地址(MAC地址),即使设备不可发现/可见,您也可以直接连接到该设备。 在实践中,这是一件好事,许多制造商通过让设备仅在特定时期(如配对过程中)可见或者具有明确的菜单选项以在特定时间段内启用发现能力来实现这一点。 从安全角度来看,这是一种很好的做法,因为它可以防止设备跟踪/黑客攻击。

例如,当蓝牙打开时,iPhone默认情况下是不可发现的(但您仍然可以连接到它),只有从设置菜单进入蓝牙菜单时才能发现它。

答案 2 :(得分:1)

可以在蓝牙标准下使用。我已经多次使用我提前知道的MAC地址连接Bluegiga的两个模块。

Android将允许您使用createInsecureRfcommSocketToServiceRecord

执行此操作
相关问题