Code example for BluetoothSocket

Methods: isConnected

0
        private static final String TAG = "BluetoothIO.ConnectThread";
 
        ConnectThread() { 
            try { 
                mBtSocket = mBtDevice.createRfcommSocketToServiceRecord(MY_EXTRA_UUID);
                String s = mBtSocket.isConnected() ? "mBtSocket is connected" : "mBtSocket is NOT connected";
                Log.d(TAG, s);
            } 
            catch (IOException e) {
                Log.d(TAG, "Create socket exception");
                e.printStackTrace();
            } 
        } 
 
        public void run() { 
            Log.d(TAG, "ConnectThread's run() method");
 
            mBtAdapter.cancelDiscovery();
 
            try { 
                mBtSocket.connect();