开发者

Android problem in setting a bluetooth service name

开发者 https://www.devze.com 2023-01-14 05:11 出处:网络
I\'m developing an application which serves as bluetooth server for a bluetooth external device (the communication is started by the external device). This external device request from the bluetooth s

I'm developing an application which serves as bluetooth server for a bluetooth external device (the communication is started by the external device). This external device request from the bluetooth service I'm deploying a concrete service name ("PWAccessP"), so I initiate the serversocket by the following instruction:

serversocket = Activa.myBluetoothAdapter.listenUsingRfcommWithServiceRecord("PWA开发者_如何学JAVAccessP", UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));

But when with a test application which search the bluetooth services offered by my phone, I get the following log:

search services on 38E7D82E98F8 HTC Desire
service Unknown found btspp://38E7D82E98F8:22;authenticate=false;encrypt=false;master=false

With "Unknown" as service name, indicating that the name of the offered service is unknown. I've checked this service is the one I'm deploying.

The phone I'm working is a HTC Desire.

Does anybody know what can be the problem?

Thanks in advance.


maybe the problem is related to android 2.1. I have no problem creating new service with 'PWAccessP' as service name. maybe you should try with a android 2.2 device.

just to give u a heads up, PWAccessP device will store the RFCOMM channel number from the pervious connection, and will use this number to connect to the SPP server device. so if your Android SPP app is restarted and registers a new RFCOMM chanel number, connection will fail, and PWAccess device will restart the inquiry process again.. this is a problem on the device. By right, it should perform SDP query first before making RFCOMM connection, but it doesnt.

0

精彩评论

暂无评论...
验证码 换一张
取 消