hello all, i used windows operation to pair my usb bluetooth dongle with a bluetooth enabled mobile phone. i am now writing an application that discovers remote devices and prints them out, but i am trying to add a code that will print a simple line like "Hi" to my bluetooth device that was already paired with my dongle as it gets discovered during the process. i tried using the retrieveDevices()method but i can't seem to figure it out correctly. it keeps printing the same "Hi" to all the devices found. i don't know if am doing this correctly as am just a beginner. but here is the part of the code that am having trouble with:
Code:public void deviceDiscovered(RemoteDevice btdevice, DeviceClass cod) { System.out.println(" Device Found = " + btdevice.getBluetoothAddress()); try { System.out.println(" Device Name = " + btdevice.getFriendlyName(false)); } catch (IOException ex) { Logger.getLogger(BTHomeServer.class.getName()).log(Level.SEVERE, null, ex); } DeviceFound.addElement(InqCompleted); RemoteDevice[] agent2 = agent.retrieveDevices(DiscoveryAgent.PREKNOWN); if(agent2 != null){ int s = agent2.length; for(int i = 0; i<s; i++){ DeviceFound.elementAt(i); System.out.print((i+1)+ ". Hi " + btdevice.getBluetoothAddress()); } } }

Reply With Quote

