Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connect to non-discoverable bluetooth device

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.

like image 305
JPro Avatar asked Oct 13 '10 10:10

JPro


1 Answers

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...
like image 136
Alex Avatar answered Nov 15 '22 09:11

Alex