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 
			String deviceName = device.getName();
			if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
				String address = device.getAddress();
				System.err.println((deviceName + "\n" + address));
				 
				devicesAddr.put(address,deviceName);
				 
				// send the founded devices back to gui 
				BTService.sendAddrToPeopleActivity(address,deviceName);
				 
				// TODO later start here a different service or thread which gets the userinformation 
				// such as username and uri to the pic 
			} 
			else 
			{ 
				String address = device.getAddress();
				System.err.println((deviceName + "\n" + address));
				devicesAddr.put(address,deviceName);
				 
				// send the founded devices back to gui 
				BTService.sendAddrToPeopleActivity(address,deviceName);