Code example for BluetoothDevice

Methods: getAddressgetBondStategetName

0
		public void onReceive(final Context pContext, final Intent pIntent) { 
			final String action = pIntent.getAction(); 
 
			if (action.equals(BluetoothDevice.ACTION_FOUND)) { 
				final BluetoothDevice device = pIntent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); 
				if (device.getBondState() != BluetoothDevice.BOND_BONDED) { 
					BluetoothListDevicesActivity.this.mNewDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress()); 
				} 
			} else if (action.equals(BluetoothAdapter.ACTION_DISCOVERY_FINISHED)) { 
				BluetoothListDevicesActivity.this.setProgressBarIndeterminateVisibility(false); 
				BluetoothListDevicesActivity.this.setTitle("Select a device to connect..."); 
				if (BluetoothListDevicesActivity.this.mNewDevicesArrayAdapter.getCount() == 0) { 
					BluetoothListDevicesActivity.this.mNewDevicesArrayAdapter.add("No devices found!"); 
				} 
			} 
		} 
	}; 
 
 
	// ===========================================================