Code example for BluetoothAdapter

Methods: listenUsingInsecureRfcommWithServiceRecord

          running = true;        
          BluetoothServerSocket tmp = null;
          // Create a new listening server socket 
          try { 
               tmp = mAdapter.listenUsingInsecureRfcommWithServiceRecord(
                          NAME, MY_UUID);  
          } catch (IOException e) {
              Log.e(TAG, "listen() failed (RfcommWithServiceRecord)", e);
          mmServerSocket = tmp;
       public void run() { 
          try { 
        	  if (D) Log.d(TAG, "Starting to listen for new connection within the Bluetooth Server on port");
        	  setName(" Bluetooth Connection Listener");
Contextual code suggestions in your IDE  Get Codota for Java