Bluetooth list not seen


I am not able to see list of available bluetooth devices. Just black screen. I have already uploaded my block image. Device name : Redmi 9 Power

Because you don't have permission for it
also, were do you scan for devices??

(image is draggable)

(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.



When Permission Granted (@Patryk)

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:

1 Like

Hi,
I am new in App Inventor and I am writing to ask your support.
I want to develop an app to send&receive data from the smartphone to HC5+Arduino by Bluetooth.
I have search information and copied the code but I still have problem.
The problem is when I try to open the list of BT devices, the screen is black and no list appears.

I have allowed all permission to the APP but the issue is still present.
My smartphone is a Samsung Galaxy A13 with Android version 13.

Please, could you help me to understand why it does not work?
Thanks in advance
Fulvio



I don't see you asking for permission to do a Bluetooth Scan for Devices.

(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:

See Bluetooth liste of devices deosn't work anymore - #7 by Anke
Special note for Xiaomi devices:
I have an error with bluetooth on android 12, Xiaomi Poco X3 NFC - #20 by Patryk_F

Hi ABG,
thanks for your answer.
I have allowed all permission to the APP but the issue is still present.

Regards,
Fulvio

What model phone?

(Canned Reply: ABG - Download those blocks and post them here)

Please download and post each of those event block(s)/procedures here ...
P.S. These blocks can be dragged directly into your Blocks Editor workspace.

See Download Block Images for a demo.