BLE list of devices

Hello. I'm making an app that delivers a list of nearby BLE devices in a simple tag. But it doesn't work and I can't find the problem.When click Boton1 I get an empty list like []

Attached the blocks of the project. Thank you very much to those who can guide me.

Welcome!
See here

Taifun

1 Like

The Device List is not produced instantly, you need to give the scan at least a second or two to find available devices - use a Clock Timer.

Can I ask why you are storing the entire List as a single Item in a Blocks List? It won't be retained when the App is closed.

Hello CrisWard. Thank you for your answer. Do you mean that it is neccesary waiting at least a second before fill the list?
In connection with your question, my idea is to fetch "MICASA" string after the list is completed.
Regards,
Alfredo.

PS: I've never udes Clock block. I can't find where you can set the lapse. Is it configurable?

Hello Taifun. Thank you for your answer. Later I will test these apps. But by now I need to solve the Appinventor + BLE issue, because this is the first step in a bigger project.
Greetings,

Alfredo.

It is - there is actually a nice tutorial showing how handy the Clock can be:

It is not a good idea to start scanning when the Screen is initializing.

Here is a template Project, it does not deal with the Android 12 permissions but it shows how to use a Clock to give enough time for the App to find all available devices.

BLE_RECEIVE_STRINGS.aia (198.7 KB)

1 Like

Have you tested the APK that @Taifun linked to (post #2)?
If so, let us know if it worked. If not, show us the screenshot.

Hello CrisWard. Thank you for your advice, it was correct! It is neccesary to make a pause before starting to scan BLE devices.
Now in this version (it has some issues I couldn't solve yet) finally can search for a specific device using its name and verify if it is (or not) turned on.
I don't need to get a connection with the device, only to verify that it is "on air".
I will continue working on this and I will ask for help if I have new problems (that is sure...)
Thank You Very much.
Greetings

Alfredo.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.