2010-05-01 33 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之間引入延遲。