Code example for BluetoothAdapter

Methods: listenUsingRfcommWithServiceRecord

0
            mSocketType = secure ? "Secure":"Insecure";
 
            // Create a new listening server socket 
            try { 
                if (secure) {
                    tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE,
                        MY_UUID_SECURE);
                } else { 
                    tmp = mAdapter.listenUsingInsecureRfcommWithServiceRecord(
                            NAME_INSECURE, MY_UUID_INSECURE);
                } 
            } catch (IOException e) {
                Log.e(TAG, "Socket Type: " + mSocketType + "listen() failed", e);
            } 
            mmServerSocket = tmp;
        } 
 
        public void run() { 
            if (D) Log.d(TAG, "Socket Type: " + mSocketType +
                    "BEGIN mAcceptThread" + this);
            setName("AcceptThread" + mSocketType);