I make a simple BT chat. Part of the code is taken from the Google sample. So the question is, can we search only devices on which the client of our BT chat is installed or available in the search for devices (maybe our BT socket is running)? Sample google

    1 answer 1

    Sure you may. The search for devices is divided into 2 phases:

    1. Device discovery - search for devices (at least some). A Bluetooth device is required to have DiscoveryAgent - a device discovery agent. The result of the search will be an array of RemoteDevice . Example for example here
    2. Next, you can organize a search for services in the RemoteDevice array. The DiscoveryAgent.searchServices() method is responsible for this. Only it is necessary not to forget that it is necessary to register on the remote device what services it "puts" outside. This is done through the publication in the so-called. SDDB - Service Discovery Database (the whole procedure is described here )
    • It remains to fasten here developer.android.com/resources/samples/BluetoothChat/src/com/ ... It is necessary to output only those that have the service of the same program - AndroidDev
    • one
      Well, fasten - who is the developer? Me or you? - Barmaley
    • (the whole procedure is described here) The link is not working) - AndroidDev
    • one
      I would like to try, and the link dosihpor refers to the hashcode - AndroidDev
    • corrected the link - Barmaley