Code example for BluetoothDevice

Methods: getAddress, getBondState, getName

0
            // When discovery finds a device 
            if (BluetoothDevice.ACTION_FOUND.equals(action)) { 
                // Get the BluetoothDevice object from the Intent 
                BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); 
                // If it's already paired, skip it, because it's been listed already 
                if (device.getBondState() != BluetoothDevice.BOND_BONDED) { 
                    mNewDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress()); 
                } 
            // When discovery is finished, change the Activity title 
            } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) { 
                setProgressBarIndeterminateVisibility(false); 
                setTitle("select device"); 
                if (mNewDevicesArrayAdapter.getCount() == 0) { 
                    String noDevices = "no device found"; 
                    mNewDevicesArrayAdapter.add(noDevices); 
                } 
            } 
        } 
    }; 
	 
}