I made an app that uses Bluetooth LE Extension. The App works great but when I am in an environment with too many devices (I think they use smoke detector with Bluetooth) the app gets very slowly, and I cannot choose my device. Does anybody know if there is a bug in this extension?
It's not possible to filter the devices by name before they will be written to the device-list, and I cannot filter out devices without name. Perhaps this is the problem. Perhaps this extension should be improved.
I'm not sure if it makes sense to move my post to this post. The problem is different.
I cannot find a test environment with so many Bluetooth devices here. The bug just happens when I use the app on a fair, for example – any environment with very much Bluetooth LE devices.
I don't have difficulties using the Bluetooth LE extension with Android 13. Anyway, I can test the apps if that would help anyone else.
Yes do that. We'd love to see your "many devices" and if there are any problems with the devices being listed or whatever. And please post screenshots.
No problem with that. The problem was the one I described before. Than you moved my topic to here, and I offered to test your apk. You told me to take a screenshot of it, and I've done. My topic has nothing to do with the main topic here, except that it's about improvements to the Bluetooth LE Extension.
I made an app that uses Bluetooth LE Extension. The App works great but when I am in an environment with too many devices (I think they use smoke detector with Bluetooth) the app gets very slowly, and I cannot choose my device. Does anybody know if there is a bug in this extension?
It's not possible to filter the devices by name before they will be written to the device-list, and I cannot filter out devices without name. Perhaps this is the problem. Perhaps this extension should be improved.
I cannot check whether the described problem will exist with the new extension because I don't have an environment with too many BLE devices here. This happens for example on fairs, where hundreds of devices were found.
That has nothing to do with the Extension and everything to do with the hardware's program. The program must include a name. If the manufacturer has applied a name, all of the detectors from one manufacturer will most likely have an identical name, which would be good for filtering-out (assuming only one or two detector manufactures). If, on the other hand, each device you want to list is actually named, then you can filter-in those which may be much quicker if you know the total number of devices as you can stop the scan once the required devices have been found.
I doubt this is the case but if the devices you wish to find are always the same ones, then a scan of available devices is not required. The App can store the device addresses and simply connect only with them.
Concerning the number of devices being in the hundreds, that is bound to slow down a Smartphone because of the intrinsic design of BLE itself. Use a Clock Timer to allow all the devices to be found and added to the list.
Okay, so the solution should be the following: All devices, I want to use, contains "BTG" in the name. So I scan for a specific short period of time, then stop the scan and add all devices that contains "BTG" in the name to a list. Then repeat the process to find more devices with the correct name and add them to my list – if not there yet. Right?
I'm wondering what environment do you want to scan/find devices in when there are tens or hundreds of devices available there. If previously found devices are known, they should be saved in a list (TinyDB) and it can then be queried which of the devices found during scanning (in an environment with many devices) are already contained in the saved list. Only devices that are already known can be listed.
So answer the question, what environment are we talking about, where dozens of devices can be listed. And which of these devices should be listed - for what reasons? And which other users might also have access to these devices during this time?
I admit that I haven't worked with the BLE extension very often, so I'm not familiar with all the possible scenarios. So what exactly is the aim/purpose of your app?
I don't see any device with "BTG" in the list (of your screenshot).
Btw, the .FoundDeviceName_index method seems to return an empty string. Is yours different?
Okay: I use a Powermeter that measures electrical measurements and give them via Bluetooth to an Android App. There is an ugly app from the manufacturer, so I sniffed the communication and made my own app. The Powermeters has different names, but all names contains BTG. The App includes a Bluetooth search that list all devices that contains BTG in the name. I choose one of them and the device is connected. The connected device is stored in the app cache and when I restart the app it will automatically search for this Powermeter.
Now, my problem happens when I try to use this Powermeter on a fair. The app starts to scan devices and put all devices to the BluetoothLE.DeviceList (that is generated automatically, when I use When BluetoothLE.DeviceFound) from where the app should copy the ones with the right name to my own list and select the right one to connect. But when there are too many devices around it crashed (or will get very very slowly - not useable anymore).
My though was that it should be possible to filter the devices before they are put to BluetoothLE.DeviceList to prevent that crash.
My Block looks like this. I think I do nearly the same. (I use Buttons instead of a listview because the device needs to operate from an Android TV without touchscreen, too)
Well, your posts go in a direction that actually has nothing to do with the original topic anymore. So these should be moved to a new topic again - but not under the "Bugs" category.
Maybe some PU can do that, since I don't have much time at the moment.
What is interesting is that devices are found one-at-a-time. Snag is, the Extension, in an ideal environment, finds devices in a short space of time, possibly too quickly to test each as they are found, but we can try (untested code!):
I have asked MIT Guru Evan Patton if he can add a new function to the Extension to filter the BLE Device List on-the-fly. Note that we have never required this before so it isn't a priority - but since Evan is currently working on an Extension update, we might get lucky!