简体   繁体   中英

Identify android bluetooth device in android

Im doing bluetooth apps in android api level 15, I want to coneect remote device using bluetooth. I get UUIDs using fetchUuidsWithSdp(). I am getting uuids for all other devices like nokia, pc but not android device.

From Doucment,

fetchUuidsWithSdp().//This API is asynchronous and ACTION_UUID intent is sent, with the UUIDs supported by the remote end. If there is an error in getting the SDP records or if the process takes a long time, ACTION_UUID intent is sent with the UUIDs that is currently present in the cache. Clients should use the getUuids() to get UUIDs if service discovery is not to be performed.

From docs 'Clients should use the getUuids()', My question is, How can i identified that UUID is from other devices or from android?

You can't.

From the Android docs : "The point of a UUID is that it's big enough that you can select any random and it won't clash."

Apart from Serial Port Profile's (SPP) UUID 00001101-0000-1000-8000-00805F9B34FB , there are no well-known UUIDs for the reason stated above.

0x1101 is the ID of the Serial Port Profile - that's why the UUID begins with 00001101 . So you are apparently able to identify the profiles the other device supports (that's the primary reason for SDP in the first place). You might try to look into the Device ID (DID) profile and see if there's anything you can rely on for detecting the other side's manufacturer.

Regarding you're not getting any UUIDs from Android devices: Make sure those devices actually offer at least one service via Bluetooth (Network Access, for instance) - you should then get a UUID which begins with the ID of a Network Access profile (eg PAN).

The difference between getUuids() and fetchUuidsWithSdp() is, like the docs state, that the latter actually performs a SDP request to the other device, while the former just returns those fetched with the last response (most commonly the one received upon discovery with Bluetooth 2.1+).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM