Android Bluetooth PBAP
I'm gonna try to introduce briefly what I'm working on, and then present my question... any help will be very much appreciated!
I've been trying to connect an Android device to other phones in order to import their phonebook info over bluetooth, using the phonebook access profile. To achieve that, I'm trying to place my device as PCE, while 开发者_JAVA技巧the other phone will act as the PSE.
I know that the PSE role is already implemented on Android, so I'm looking into its code and trying to somehow reverse engineer it to implement the other side.
So.. my problem is: when the server socket is created, it doesn't specify any UUID, it simply starts listening on a port 19, like this:
mServerSocket = mAdapter.listenUsingRfcommOn(PORT_NUM);
Wasn't it supposed to register the PBAP service somewhere? How does other devices discover the service, and more important, which UUID should I use when trying to connect in my PCE device with:
mSocket = mDevice.createRfcommSocketToServiceRecord(UUID_PBAP);
Thanks, Pedro.
you should use uuid to create a client socket, sdp will find the crosponding channel for you.
you need not care about the channel number and the channel you assign is not always right in various.
please use this method:listenUsingRfcommWithServiceRecord of BluetoothAdapter with the right UUID.
精彩评论