[android-developers] Bluetooth server and channel number
Hi all.
I'm facing a problem I don't find how to handle.
I'm doing an application that listen for bluetooth incomming
connection.
As recommanded,
- I have a BluetoothServerSocket that call
listenUsingRfcommWithServiceRecord(()
- I'm asking for the BluetoothSocket with accept() method of
BluetoothServerSocket.
- when a connection is received, the BluetoothServerSocket is closed.
First, notice that
http://developer.android.com/guide/topics/wireless/bluetooth.html
says on "Connecting as a server" section :
"Unless you want to accept additional connections, call
[BluetoothServerSocket] close(). "
that's what I've done but, unless I'm wrong, the chat Sample
http://developer.android.com/resources/samples/BluetoothChat/src/com/example/android/BluetoothChat/BluetoothChatService.html
does not do it although it accept only one connection ...
So the problem is that when listenUsingRfcommWithServiceRecord() is
called again, the channel change.
But clients continues to think that the service is on the previous
channel.
The problem is not on client side because just stopping/starting
bluetooth on the android server make the client find the new channel
for the service.
For now, all I can do is not closing BluetoothServerSocket but if the
client reconnect quicker than the server calling accept(), the client
is connected on ... nothing. the call to accept will not return this
connection.
Does anybody figure out the same problem or have any advice ?
Thanks for any help !
Mike
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home