开发者

Problem with bluetooth service in J2ME don't discoverable

开发者 https://www.devze.com 2022-12-28 16:15 出处:网络
I try to create a service with: LocalDevice localDevice = LocalDevice.getLocalDevice(); localDevice.setDiscoverable(DiscoveryAgent.GIAC);

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.

0

精彩评论

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

关注公众号