Code example for BluetoothAdapter

Methods: listenUsingRfcommWithServiceRecord

0
        public AcceptThread() { 
            BluetoothServerSocket tmp = null;
 
            // Create a new listening server socket 
            try { 
                tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME, SPP_UUID);
            } catch (IOException e) {
                Log.e(TAG, "listen() failed", e);
            } 
            mmServerSocket = tmp;
        } 
 
        public void run() { 
            if (D) Log.d(TAG, "BEGIN mAcceptThread" + this);
            setName("AcceptThread");
            BluetoothSocket socket = null;
 
            // Listen to the server socket if we're not connected 
            while (mState != BtSPPHelper.State.CONNECTED) {
                try { 
                    // This is a blocking call and will only return on a