BLE not scanning or showing an devices

Hey guys,

So I had created an app before a couple years ago that allowed me to connect my Arduino HM-10 BLE to my App Inventor app via the BLE extension. I recently decided to upgrade it, however, to my surprise, my app isn't listing any available devices.

What's strange is I know a previously downloaded app from App Inventor works perfectly fine and other apps, but the app I am creating doesn't work at all. The code in the image is identical to the code in the old app, but whenever I press scan, nothing shows up on the list.

Here is the code I am using following this tutorial:

The problem is that older apps that I had already downloaded onto my device using the same code from App Inventor still work perfectly find and I can find and connect to my BLE module. However, when I go to create a new app, no devices show up. To me, this means that there isn't any problems in my BLE module and phone itself, but the code isn't coding.

If it means anything, my Android device is running on 8.1.0 and I have all permissions enabled. Also, I updated the companion app to the newest version yesterday, so I don't know it there is a problem with that.

[Edit]: Ok so here's something interesting. You know the App Inventor app that I said that was already downloaded before and worked fine? I literally opened that project up and tried scanning with the Companion app, and it suddenly doesn't display anything. Here is the app:
ARD_HM10_AI2_3LEDs_3Switches_08.aia (163.0 KB)

Does anyone have an ideas on how I can solve this? It's frustrating because the code that used to work perfectly fine suddenly doesn't work at all and my suspicion is that it has something to do with me updating the companion app.

(Canned Response)
These blocks can be dragged into your Blocks Editor to request permission(s) for Bluetooth scanning and connecting. All three parts are needed.

Thanks to @Anke for the original code.
My changes include

  • use of the Screen1 permission blocks to avoid the possibility of a typo
  • using a TinyDB tag particular to BT permissions and only for BT permissions.


Thanks! I see that it says Bluetooth, but I’m using the BluetoothLE extension. Will it work?

I also added a block of code that will set the text of the label equal to whether or not BLE started scanning

However, when I press scan, the label changes to "false", indicating that the bluetoothLE never even started scanning, despite there being a block only two above that says "StartScanning".

It doesn't matter what you use, classic or ble. From android 12, when using bluetooth, you need to ask permission to scan and connect.

No, on Android 12+ permissions (SCAN, CONNECT) are requested automatically with the latest BLE extension version (2023-02-23). But you must enable the Location sensor (manuallly).

(Btw, Location must also be enabled on Android < 12.)

1 Like

Can you please explain what this code does and what the "call LocationStatus1.isEnabled" came from and what the very last line "set ActivityStarter1.action to" does if its never called?

I have location already turned on in my phone in the permissions settings so I don't understand where the problem is.


Solution: I had location turned on for the MIT App Inventor App alone in settings, but not the phone's location (like where you would turn on and off wifi and bluetooth, airplane mode, low power mode, etc.) Nothing will scan if the Location for the phone is turned off even if the location settings for the App is turned on

Thanks for the help!

As I've said often enough.

Ya you were right, I kept misunderstanding your suggestion for having location permission enabled for the app itself instead of location for the whole phone itself to be turned on, so my apologies.

Thank you for all of your help!

Both versions of Bluetooth extension return classic addresses, do not return BLE addresses. Bluetooth Terminal app shows and connects successfully to BLE.

Try this and post a screenshot:

Turning off the location settings do not change the list contents which do not include the BLE addresses. The underlying android Bluetooth libraries separate the classic from the BLE handlers, the extension is using the wrong handler (interfacel.

Did you try the app (APK)? If so, post a screenshot.

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