Code example for BluetoothSocket

Methods: closeconnectisConnected

0
            String error = "Unable to open a socket to device " + device;
            Log.w(TAG, error);
            throw new BluetoothException(error, e);
        } 
 
        if(!socket.isConnected()) {
            try { 
                socket.connect();
            } catch(IOException e) {
                String error = "Could not connect socket to SPP service on " +
                    device;
                Log.e(TAG, error);
                try { 
                    socket.close();
                } catch(IOException e2) {}
                throw new BluetoothException(error, e);
            } 
        } else { 
            Log.d(TAG, "Bluetooth socket already connected");
        } 
Connect your IDE to all the code out there  Get Codota for Java