2010-05-01 59 views
1

我试图创建一个服务:问题在J2ME蓝牙服务没有发现

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,但反过来反过来,我不知道是什么问题,我已经认为安全问题...

任何想法?

谢谢!

回答

0

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