Code example for BluetoothAdapter

Methods: getAddress, listenUsingRfcommWithServiceRecord

0
 
            // Create a new listening server socket 
            try { 
                try { 
                    if (DBG) Log.d(TAG, "Bluetooth corral listening on " +
                            adapter.getAddress() + ":" + coralUuid);
                    tmp = adapter.listenUsingRfcommWithServiceRecord(
                            BT_CORRAL_NAME, coralUuid);
                } catch (NoSuchMethodError e) {
                    // Let's not deal with pairing UI. 
                } 
            } catch (IOException e) {
                Log.e(TAG, "Could not open bt server socket");
                e.printStackTrace(System.err);
            } catch (NoSuchMethodError e) {
                Log.e(TAG, "Bluetooth Corral not available for this Android version.");
            } 
            mmServerSocket = tmp;
        } 
 
        public void run() {