Code example for BluetoothAdapter

Methods: listenUsingRfcommWithServiceRecord

0
        mServiceMessageHandler = serviceMessageHandler;
        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        log.debug(CLASS + getId() + ": mmBluetoothServerSocket opening...");
        try { 
            // SPP_UUID is the app's UUID string, also used by the client code 
            tmp = mBluetoothAdapter.listenUsingRfcommWithServiceRecord(NAME, SPP_UUID);
            log.debug(CLASS + getId() + ": mmBluetoothServerSocket opening - SUCCEEDED");
        } catch (IOException e) { 
        	log.debug(CLASS + getId() + ": mmBluetoothServerSocket opening - FAILED");
        } 
        mmBluetoothServerSocket = tmp;
    } 
 
    public void run() { 
    	try { 
    		mBluetoothSocket = null;
    		// Keep listening until exception occurs or a Bluetooth socket is returned 
    		while (true) { 
    			log.debug(CLASS + getId() + ": mmBluetoothServerSocket listening...");
    			try { 
    				mBluetoothSocket = mmBluetoothServerSocket.accept();