I am trying to make an app using app inventor. I tried blt client and made a mock up app to just get connected to something, but it does not scan devices, just shows the paired ones. Anyone knows why?
The Android phone is android 13, I tried with samsung S20 and S22
For pairing you will need an extension
To see the devices you will gave to ask for permission as in @ABG's example beliw
Taifun
(Canned Response ABG - Bluetooth non-BLE SCAN Permission Blocks)
The easiest solution, for immediate relief
(from @Barry_Meaker) ...
I had the same issue. The problem is your app does not have permission to see nearby devices. The solution is to give your app permission on your phone (no code changes in your app).
on your phone,
- goto settings
- search for your app
- in App Info for your app select Permissions
- change Nearby Devices from Not Allowed to Allowed
- Done
By the way, the very first time you run the app, Android will ask if you want to grant the app this permission. If you say no, or ignore the pop-up, the permission will be set as Denied. Android will not ask again.
A more complex approach, for professional app development:
These blocks can be dragged into your Blocks Editor to request permission(s) for Bluetooth non-BLE scanning and connecting. All three parts are needed.
You also will need to pull in TinyDB into your project.
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 to @Patryk_F for correction to grant order)
Special note for Xiaomi devices: