I try to create a service with:
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();
//...
I run this code on a Nokia 5800 and Nokia 2760, with 5800 I can see 2760, but not vice versa, I don't know what is the problem, I have think security problems...
Any ideas?
Thanks!
The problem was in the search, the device threw a BluetoothStateException giving "Busy". The solution I have found is introducing a delay between deviceSearch and serviceSearch.
精彩评论