Good bargain here. I have two bluetooth-enabled Galaxy Nexus phones.
I wrote a Bluetooth connection management application that I use to discover and connect devices. It also displays all available UUIDs that devices can support.
If you look at http://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm , the following standard UUIDs will be displayed from Galaxy Nexus devices.
- 0x1116 - NAP
- 0x112f - PBAP (Phonebook Access Profile)
- 0x111f - HFP (hands-free)
- 0x1105 - OPP (object profile)
- 0x1112 - HSP (headset profile)
- 0x110c - AVRCP
- 0x110a - A2DP
I am trying to connect through an OPP profile ( UUID 00001105-0000-1000-8000-00805F9B34FB ) and click objects (files) between devices. I read all the Android API API documentation on how to detect, establish a pair / connection (streams, etc.) and manage all Bluetooth connections. I was able to successfully connect and talk to an outdated paid device through the SPP profile (0x1101).
However, when I try to use socket.connect() between two phones of the Nexus galaxy, a pairing dialog appears, and I press the Pair button on both devices. After that, I immediately get Connection Refused IOException . Note that after pairing has occurred, I never ask what makes sense, since the secure link is cached.
If I cannot connect to these standard profiles using these standard UUIDs, why are they displayed? How can I connect and interact with any of these profiles from my application? Is it because my application is not so trusted? What is strange is that even the Share functionality on Android does not work either. Is this something completely broken on Android?
Please avoid giving me hints to use the “well-known UUID SPP one 0x1101,” as the docs say. This is not what I want. I have a pretty good idea of how this stuff works, and I'm looking for a real solution or explanation of the problem.
I saw a typical reflection solution, but I don’t understand why this is still a problem on Android? Why do people use reflection to do this job? Can we register an error on Android to fix this?
If these UUIDs are standard, any application should be able to connect and interact with them. Why is this a problem and why am I getting this exception?
Thanks in advance.
UPDATE
So, for some reason, the object began to work in the Android system. I really tried to connect through my application and it did not work. Then I went to the Contacts app and tried to split the contact that worked magically. Then I went back to my application, and now it works ... wow. This is very strange, and there must be an explanation for this.