connect to non-discoverable bluetooth device
Asked Answered
B

3

8

I am developing an app for android. Just a general questions as to , if is it possible to connect to a device which is non discoverable publicly?

Thanks in advance.

Bader answered 13/10, 2010 at 10:56 Comment(0)
S
6

If you have previously paired with the device then it is possible to connect to it again even if it is not in discoverable mode. See this post: 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...
Scleritis answered 17/8, 2011 at 23:50 Comment(0)
F
3

By discoverable I assume you meant responding to device searchs from another device. Some manufacturers also refer to it as visible. Depending on the manufacturer of the device , some devices allow Bluetooth to be on and visibility/discover-ability to be set to off. So if you already know the Bluetooth Address (MAC Address) of the device you can directly connect to it even when the device is not discoverable/visible. In practice it is a good thing to do, many manufacturers allow for this by having the device visible only during specific periods like during the paring process or have explicit menu option to turn on discover-ability for a specific period. This is a good practice from a security stand-point as it prevents device tracking / hacking.

iPhone for example is by default non-discoverable when Bluetooth is on, (but you can still connect to it) it is only discoverable when you enter the Bluetooth menu from the settings menu.

Frum answered 19/10, 2010 at 19:6 Comment(0)
P
1

It is possible under the Bluetooth standard. I have done this many times connecting two modules from Bluegiga together simply using the MAC address that I knew ahead of time.

Android will let you do this with createInsecureRfcommSocketToServiceRecord

Peraza answered 21/8, 2013 at 2:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.