Name of devices not available in the device list

I'm developing an application to read data from an ESP32S3 Zero. I'm using the NimBLEDevice library. As you can see in the image, when I display the device list, the name of my device doesn't appear , others appear. This would be essential for me, as I'll have several similar devices with different names in the same area, and I need to differentiate them by name, since the MAC address isn't useful. I'm using the BluetoothLE extension 20240822.
If I connect using the MAC address, I connect correctly and read the data without issue, and I can display it in a text field.


With this other application the Name can be seen defined so I understand that it is a problem in the smartphone application.

I would appreciate any help on how to get the names of all the devices.

What about if you fill the listpicker elements with :
image
(not tested, just and idea..).
Of course I suppose that in your ESP32 code you have given a meaningful name to the BT server, like:

#include <BluetoothSerial.h>
BluetoothSerial SerialBT;
SerialBT.begin("TRIPMaster"); // name to be shown in the devices list

Hoping it can help.

The result is an empty list. I understand little about BLE, but I assume it should be previously connected to a specific device.
Regarding the name in the NimBLEDevice library, it's used a little differently:
NimBLEDevice::init("V:01"); in my case. As you can see, it corresponds to the value read in the second image. Also it is not Bluetooth serial but BLE
Thanks for your comments.

Dear @Miguel_Angel_Torra_R,
yes I understand that it's not the classic BT in your ESP32, but it was just to say that you should find a "name" in your devices list, if you have set a name in the ESP32 code. Anyway, you have perfectly understodd what I meant :hugs:

"The result is an empty list". This isn't exactly what your picture shows: the list of available devices is full of devices, but the "names" aren't displayed, as you said in your first post. To this purpose (and since you have a BLE) I suggested you to show the AdvertiserNames in the list picker elements: did you try this hypotesis ? (I'mnot a guru in BLE, but it worths a try...).
And, please verify you're using the latest version of the extension, here:

https://community.appinventor.mit.edu/uploads/short-url/ylaGF5c9aUfubvf3UJTjdsVvSf6.aix

as per:

You could also take a look here:

Best wishes !!!

EDIT: pelase don't forget to allow the geoloc permission, at system level, to your app, otherwise the BT is not allowed to work (thanks to Google's restrictions)

EDIT II:
the annexed files are an example that I tested (Android 9, Lenovo PAD 8", ESP32Dev module) some time ago. Maybe they could help...
ESP32_BLE.ino (4.4 KB)

BLE_Test.aia (254.8 KB)

EDIT III:
in GutHub:

Hi, thanks again. I'm continuing to investigate, and I see that once connected to the device, if I request the device name, I get an error because it's an empty element and doesn't contain any text. However, if I read the corresponding position, the name is readable.

I also see that all the feature lists are defined as unknown. I think this is the problem, but I'm not sure why.

Greetings

Dear @Miguel_Angel_Torra_R,
I'm awfully sorry but, as I've said, I'm not a BLE guru :disappointed_relieved:
Probably other PU's (or even @ewpatton ) can tell you more...
Best wishes.

PS: but have you tried my .aia ? I see that it seems that the error message is related to an "unknown characteristic". What happens if you change the characteristic UUID ?

No, I believe that the problem is centered in the general characteristics of access which is a generic service and by which the UUIDs are its own known. The UUID of the service accesses the data is not necessary, it will work correctly.

I've tried other types of connection instructions with devices provided by the extension, but I can't use anything other than the one related to the MAC address.

I'm surprised that despite connecting to a device with a MAC address, I'm unable to identify the device name with the extension's tools. If I try to type the name in a text field, it gives an error.

However, if I read the address that contains that data, I can do so. That makes me think the extension isn't doing what I think it's doing. I wonder if you could shed some light on this matter. Thanks .

I have located another device that does define a name in the list of available devices. A "Hello" appears, but it does not correspond to the device name defined in the device's generic access parameters. UUID 0x2A00, which is the one we defined with the NimBLEDevice::init("V:01"); instruction in our case. Therefore, nothing appears in the list of names.
I consulted an AI and received the response that it is necessary to define the name of the advertising device before starting it. This way, it appears in the list of devices as the device name.
pAdvertising->setName("V:01");
pAdvertising->start();

Other connection modes also work this way, for example by name and UUID Service.

Dear @Miguel_Angel_Torra_R,
many thanks for having shared all your attempts.
I will try them in the next days. My only concern is that I have only Android devices with "old" OS versions (#10) that could behave slightly different with respect to newer ones (i.e. less restrictions)
All the best.

Dear @Miguel_Angel_Torra_R ,
I've tested the BLE on my devices and this is what I've got.
On the ESP32 I have the following code: (please note that I assign the name to the ESP32 BLE server as "UART Service" and this assignment is the very first instruction into the setup() function.
image

The ESP code is annexed at post's end.
To correctly compile it you shall remove (if installed) the BLE library here below:
image

In the AI2 code in the Screen1.Initialise:


The devices listpicker is loaded with the BT devices' addresses and names. Please note that I don't use the BLEclient, but the BTclient, so I can see the complete list of all the BT devices in the neighbor. At that level the list picker shows addresses and names among with I can select the wanted BLE server (UART Service):

You can see that he name is properly retrieved and shown (UART Service).

Further: if at any time I Disconnect the BLE (Disconnect button), and after a while I reconnect it (Scan&Connect button), the name is also displayed again into a TexBox:

Probably is the sequence of BLE isntructions in the ESP32 code (as you have already highlighted on your own) that allows the name to be transmitted from the server to the client. But also the sequence (and the delays) of the instructions in the app. For example, the scan for devices is allocated into a clock:

Here below the .aia that contains what I've explained above and some modifications/improvements with respect to the one annexed a few posts above (please use this one and discard the former one).
BLE_Test.aia (257.5 KB)

And, for sake of information completeness also the .ino again:
ESP32_BLE.ino (4.4 KB)

In a nutshell: in my implementation the "name" of the BLE device to connect is shown, both a BTclient list and BLEscan list. As I said, my level of Android is old enough (#10) to have less resrictions, but I don't know if this is what makes the difference. What I can suggest is therefore to try both (.ino and .aia) my codes and to see what happens in your setup.
Best wishes !

Thanks for your comments. If you'd allow me, I think it's simpler the way I do it. I just use the name to connect, and there's no need to scan, etc. the extension searches for the device and connects directly. It's clear that I know the name of the device I'm looking for. I simply need to add the name before starting notifications on ESP32, and the list is populated. The BLE extension also accepts it as the device name. With these modules, I connect, receive data, and reconnect in case of a connection loss.
I've included images of the included modules so you can analyze them.This corresponds to a specific screen for BLE.
Regards


Nota: The UUIDs are specific and defined in ESP32. But if you're interested, I can download the aia for you to run tests.

Dear @Miguel_Angel_Torra_R,
glad you've solved the issue ! Effectively if you develop an app for yourself and you know in advance the "name" or the "address" of the BT or BLE device to be connected, the use of the list picker is not necessary. In my apps where I use the BT, typically I store the possible addresses into a text file so I can add/modify/cancel easily the addresses when I need to have more than one device of the same type (for example one simulator and one, or more, devices used in field). Then the app reads the file and uses the first address and tries the connection, if the connection fails, it reads the second address and so on.
Cheers, Ugo.