05-05-2010 01:32 PM
In my project I use bluetooth getFriendlyName(true) method, but this method
blocks UI events, so I cannot navigate the UI elements until the getFriendlyName(true)
returns. Can you suggest how I can make the UI responsive as
scanning for friendly name occurs in the background? I already have this
scan in a background thread.
05-05-2010 01:55 PM
If you have it in a background thread, then it should not be interfering with the UI events.
What is your UI event thread doing while the blutooth discovery is going on?
12-30-2010 07:31 PM
I just wasted a few hours on this issue myself and thought I'd fill in the details of what is going on for anyone else who encounters this.
The inquiryCompleted() callback is always called on the event (UI) thread, even if you call startInquiry() from a background thread. You can verify this by having your code check the result of UiApplication.getUiApplication().isEventThread(
Since getFriendlyName() can open a connection to the device, it should not be called from inside of inquiryCompleted() because it will block the UI. Once you get the list of discovered devices, you can call getFriendlyName() on each one on another background thread.