Beta version of BLE extension for Android 12 permission changes

it was just for dummy for get permission when first run.

sometimes its asking permission when the just openned first time(without any actions), but sometimes its not asking. so i made button to activate. i don't know actual condition of these differences but i guess its from minimum SDK level or just AI2<->kodular build conditions.

ofc im using as you shown for event to find devices.

the problem and my purpose is to make permission for "BLUETOOTH_ADVERTISE".

thank you :slight_smile:

1 Like

... that should be the Classic BT BluetoothClient block, not the BLE block, as per Anke's post.

You should then place a .Connect block in a way (unobtrusive and separate from your blocks/procedures) that avoids a Connection error / ConnectionFailed.

do you mean like perfectly seperated, cannot use?

whatever it worked :slight_smile:

maybe ewpatton fixed it


And this procedure, of course, is not used anywhere.

then it was right. thank you!

If you need beta tester, let me know.

I have read 4 threads regarding the connection issue which is from the latest version of AppInventor.
I worked on a mini program on Feb 15, 2023 which worked perfectly. Today it shows the error message:
" Need android.permission.BLUETOOTH_SCAN permission for AttributionSource { uid = 10267, packageName =, attributionTag = null, token = android.os.BinderProxy@76115b5, next = null }: AdapterService isDiscovering "

I tested the same mini program on the AppInventor beta version the message is identical.
I also added the extension :
Bluetooth Low Energy
Extension Version: 20230223-beta
Date Built: 2023-02-23
=> Same error message. I'm at an impasse.

test.aia (250.2 KB)

Try this and post screenshots.

I tested your app apk and put the result without the other thread.
Regarding the bluetooth problem with Android 12, how can we get around the blockage?
This work is a school project and I have to find a solution to overcome this dysfunction.
I tested the application with an old tablet under Android 4, same error. What workaround can we use please?

I tested your app apk and put the result in the other thread (sorry).

I use the Using the beta .aix and testing with issues on Samsung Galaxy S6 Lite running on Android 13

. Please have a look.
BLE_Beta_20230403A.aia (294.5 KB)

Here are additional screen shot and the video capture

Version 20201223 is working. Beta not working

Phone model:
Xiaomi 12T Pro
Miui 14
Android 13
Problem: it can scan for devices, but won't connect. tried connect with index and connect with mac.
errors: "Connection timeout", "connection status was set to OS code 4"

Phone model:
Xiaomi Mi6
Android 10
Problem: it can scan for devices, but won't connect. tried connect with index and connect with mac.
"Connection timeout", "connection status was set to OS code 133"

version 20201223 here is binding on both. I haven't tested sending and receiving data yet.

My code blocks are as in the standard recipe.

Here is an updated beta version of the BluetoothLE extension. Unfortunately I haven't had a chance to test this on an Android 12 device yet, so make sure to back up your projects before you upgrade. (202.1 KB)

1 Like


Is the source code available for the bluetoohLE beta extension? I have found some source on GitHub but it looks pre-beta.

I want to look at possibly changing it to run as a background task as my app needs to communicate with BLE devices as a background task.

Thank you friend

I am correctly advertising out of my app. But to read incoming advertisements to my app, I am doing this (in an Android 13 device):

Which gets me either this error:
Attempt to invoke virtual method 'android.bluetooth.le.ScanRecord android.bluetooth.le.ScanResult.getScanRecord()' on a null object reference
Note: You will not see another error reported for 5 seconds.

Or "null" is updated in the text.

The deviceAddress should be the one for another phone of mine or a laptop I have here, and the serviceUUID is the one in an advertiser I'm using in the "nRF connect" app.

I can provide more information to help troubleshoot.

I see the command I'm using is call BluetoothLE.AdvertisementData, but some BTLE apps call that field (or a related one, I'm just learning about this as I go) as "ManufacturerData". Hope they both refer to the same field. This is an example C# BTLE app from Microsoft which does that