简体   繁体   中英

How to query remote mobile phone via Bluetooth as to whether it supports PBAP or not?

Suppose two Android mobile phones are paired via Bluetooth and connection is established. How to programmatically determine at the client whether the remote device (the server) supports Bluetooth profiles such as PBAP?

And if it does support it, then how to programmatically initiate a PBAP session with the remote device?

I have extensively searched the net and so far have been unable to find API support and documentation for the same.

Edit

Would fetching the remote device's UUIDs be of any use here? If yes, how do I get to know whether it supports PBAP from that?

Update

I managed to connect to the remote device using:

mBluetoothSocket = mBluetoothDevice.createRfcommSocketToServiceRecord(applicationUUID);
                            btAdapter.cancelDiscovery();
                            mBluetoothSocket.connect();

where

 private UUID applicationUUID = UUID.fromString("0000111E-0000-1000-8000-00805F9B34FB");

for hands free profile mode. Is there any such fixed UUID for connecting through PBAP mode though?

Update 2

Now I am able to pair with the remote device using the UUID 0000112F, which is the UUID for PSE access. When the connection is established, I get a message on the remote device asking me whether I can allow remote device access to call logs and contacts. I click on yes.

I managed to connect to the remote device using:

mBluetoothSocket = mBluetoothDevice.createRfcommSocketToServiceRecord(applicationUUID);
                        btAdapter.cancelDiscovery();
                        mBluetoothSocket.connect();

where

 private UUID applicationUUID = UUID.fromString("0000112F-0000-1000-8000-00805F9B34FB");

I am able to pair with the remote device using the UUID 0000112F, which is the UUID for PSE access. When the connection is established, I get a message on the remote device asking me whether I can allow client access to call logs and contacts. I click on yes. PBAP connection is made.

Posting this for reference to any person struggling with this in future :).

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