0

I am building an Android app in which I need to connect to an custom device over classic Bluetooth (preferably). My problem is SDK for that device is not created to facilitate the connection. Now I am stuck onto the part where I need to create a Socket which will be opened by the custom device which is acting as a server and other Android devices will act as clients and connect to it. I am stuck at the part where we need to have identical UUIDs at both client and server for the socket connection to work. I am following the BleutoothChatApp as reference for this but I cannot always make sure that both my app and custom device will have identical UUIDs. Because I may or may not be able to hard code the UUID in custom device. What can I do in such case.? Also when I try to use BLE and search for services, I discover only one service which has no description or anything. What can I do in such cases. What will be the best approach to create a connection to that device.?

saurabh169
  • 499
  • 1
  • 4
  • 12
  • This question and `ArunKumar`'s answer would help you [Get UUIDs of discovered devices](https://stackoverflow.com/questions/14812326/android-bluetooth-get-uuids-of-discovered-devices) – Amrit kumar Jun 11 '18 at 13:41
  • But is there any other way? Because when I use the references from above answer and check for UUIDs of discovered devices, I get multiple UUIDs for same device. What can I do in such case.? – saurabh169 Jun 12 '18 at 09:39

1 Answers1

2

You get multiple UUIDs for the same device because the devices offer multiple services. Base UUID for Bluetooth is "00000000-0000-1000-8000-00805F9B34FB".

If you find this UUID in a device, it means it supports Bluetooth Service. Use the UUID for connecting to the device.

Amrit kumar
  • 466
  • 6
  • 9