Android Question Manual selection of multiple BLE advertisers?

Monolit

New Member
Is there any B4A example code of how to scan for BLE devices and manually select one of several candidates?
I have problems with this. Each time a new device is found I ask the user in a dialog if the current name is the desired. (Using "Wait for" user reply ...)
If "yes" then I stop scanning and connect to the candidate, but if "no" I simply continue waiting for a new desired candidate to show up.

The problem is that scanning either seem to stop or the desired candidate never shows up.
I feel, from observing the log, that delaying the thread by "Wait for user..." will corrupt the timing.
My conclusion is that the right way would be to buffer the discoveries in a queue and let the scanning go on until the right candidate can be seen in that queue. Preferably from a different thread?

I suppose this is a rather common task in all BLE apps, so the answer should have some interest...
I belive that it would be better to get a code snippet for this rather than help solving my shortcomings :rolleyes:

I am quite new to B4x so I need some help here.
Thanks
 

Monolit

New Member
Thanks!
Perhaps I can open a form once the first candidate is detected and then update a visible dynamic list of names until the right candidate comes up. Then click the desired name to connect and stop the scan.
Does that make sense?
It will eliminate the "wait for.." between candidates...
But how do I create such a visible and clickable form?
 
Upvote 0
Top