Code example for BluetoothAdapter

Methods: listenUsingInsecureRfcommWithServiceRecord

0
			BluetoothServerSocket tmp = null;
 
			// Create a new listening server socket 
			try { 
				if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD_MR1) {
					tmp = mBtAdapter.listenUsingInsecureRfcommWithServiceRecord("NfcHandover", mServiceUuid);
				} else { 
					tmp = InsecureBluetooth.listenUsingRfcommWithServiceRecord(mBtAdapter, "NfcHandover", mServiceUuid, false);
				} 
			} catch (IOException e) {
				Log.e(TAG, "Could not open server socket", e);
			} 
			mmServerSocket = tmp;
		} 
 
		public void run() { 
			setName("AcceptThread");
			DuplexSocket duplexSocket = null;
			 
			// Listen to the server socket always 
			while (true) {