Bluetooth can't run on Android 12, but can run on Android 8


GetAPILevel: Get the API Level of the device

Hello Yang

Bluetooth on Android 12 requires different permissions.

Note, in your code, ListPicker AfterPicking, it cannot be enabled in that Block, it must already be enabled.

Hello Anke
Thank for yuor help.
But ,why I can not find the code "when Screen1 .Initialize" in control function?

only have " if then ",or " if then else".

Hello Anke,
Many thanks.

Hello Anke,
Please tell me how to do it, about Q1 and Q2 .
Thank you.

It not easy to run BlueTooth on Android 12.

(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

Hello Taifun ,
Many thanks you for your help.

Did you check these blocks on an Android 12+ device with the APK?
If so, you should have noticed the error... then read on below...

No, these blocks, as they are, are not mine. These blocks do not work and lead to a permission error with the APK. Here are my "original" blocks:

Compare the following test AIAs:

1 Like