1

我尝试通过以下方式创建服务:

LocalDevice localDevice = LocalDevice.getLocalDevice();
localDevice.setDiscoverable(DiscoveryAgent.GIAC);
String url = "btl2cap://localhost:"+uuid.toString()+";name="+name+";authorize=true;authenticate=true;encrypt=true";
L2CAPConnectionNotifier notifier = (L2CAPConnectionNotifier)Connector.open(url);
ServiceRecord = localDevice.getRecord(notifier);
// Set some attributes
// ...       
conn = notifier.acceptAndOpen();
//...

我在诺基亚 5800 和诺基亚 2760 上运行这段代码,用 5800 我可以看到 2760,但反之不行,我不知道是什么问题,我认为安全问题...

有任何想法吗?

谢谢!

4

1 回答 1

0

问题出在搜索中,设备抛出了一个 BluetoothStateException,给出“忙碌”。我找到的解决方案是在 deviceSearch 和 serviceSearch 之间引入延迟。

于 2010-05-12T16:49:07.677 回答