Search code examples
bluetoothjava-meiobluetooth

J2ME: Discover only Computers during Bluetooth Discovery


I am writing a security application for Laptops and I began writing the DiscoveryListener in J2ME But it displays all device types like mobiles. But I want it to find only computers.

Any help regarding this???


Solution

  • There's no way to search for a specific device type. The search itself will always find all device types.

    You will have to filter out unwanted devices yourself. When a device is found, deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) is called. The DeviceClass tells you what kind of device it is. So simply ask.

    if (cod.getMajorDeviceClass()==0x100) // Yes, it's a computer of some sort.