I\'m trying to implement an Android application to receive data from a medical device but I can\'t get through the discovery process and get the phone and the device
If you can provide the name / link to the medical device (if it is a commercial device) it might help to read up its guide to guess more on what might be going on. Here are a few suggestions :
In addition to the Serial Port UUID , each service over the SPP can have a custom specific UUID - example the medical device could look for the service with which it is compatible using this custom-specific UUID.
If the medical device currently connects to a PC or some other access point successfully and transfers data , the you could try read the SDP record of that device and determine what specific UUID in addition to the SPP UUID is in use if any, and use the same in your application also.
If the medical device is not able to find your phone / application it could be because it is not discoverable. Android device by default is not discoverable even when you are a server, it will be only connectable and not discoverable, you can try to make it discoverable programetically or through the settings and see if the medical device can find your device. See here - Enabling Discoverability in Android
For PIN pairing , The android device should start the pairing process when a non paired device tries to connect to it, you can try it after getting through the recommendations (1) and (2), PIN pairing is used if one of the devices are prior to version Bluetooth 2.1 , Even with newer devices a 6-digit passkey with some user intervention / confirmation will be required at the phone to allow for the pairing (its is just a good security policy to not allow this to just happen automatically without user intervention) , hopefully pairing will only be require the first time a connection happens, later it will not require any user intervention for subsequent connections.