everyone.
I try to implement a pbap client on Android platform.
My client can get phonebook from most of android phones.
But when I connect to HTC G11, it does not work normally.
my main code is as follows:
mSocket = mDevice.createInsecureRfcommSocketToServiceRecord(ParcelUuid.fromString(PBAP_UUID).getUuid()); //it's OK here
mSocket.connect(); //it's OK here
mClientSession = new ClientSession(transport); //it's OK here
HeaderSet request_conn = new HeaderSet();
request_conn.setHeader(HeaderSet.TARGET, PBAP_TARGET);
HeaderSet return_header = mClientSession.connect(request_conn); //it's OK here
When mClientSession.connect(request_conn) called, remote device give a response code OBEX_HTTP_OK.
It means remote device accepted my pbap connection request.
But problem come out after that.
HeaderSet request_get = new HeaderSet();
request_get.setHeader(HeaderSet.NAME, name);
request_get.setHeader(HeaderSet.TYPE, type);
mGetOperation = (ClientOperation)mClientSession.get(request_get);
mInputStream = mGetOperation.openInputStream(); // problem come out here
I send a get request to remote device but remote give a response code 211 which means OBEX_SERVICE_UNAVAILABLE. So I cannot get phonebook from htc G11.
I try Nokia N9, it is the same with HTC G11. Nokia N9 give a response code 211 too.
But Nokia N9 and HTC G11 can transfer phonebook each other, and both of them can get phonebook from android phones.
Android implement pbap session layer APIs in framework/base/obex
I guess HTC G11 does not use the standard android session layer APIs.
But what does it use? what about Nokia N9?
Can anyone give me an answer or some right codes? Please help me.
I suffered from this problem a lot. Thanks!
My email: yulf88@gmail.com