Android permissions - BLE - Android 12

You could also leverage Screen1.PlatformVersion, which would need to be compared to 12.0, but it would allow you to do this in a way that doesn't require extensions. The only caveat technically would be one of the 4.2.x versions which won't coerce to numbers, but since the BLE extension requires Android 5.0 or higher this shouldn't be an issue.

I checked it now on Android 9 and removed my post.
I'll post a new aia tomorrow.

It didn't work. If I am right, you only have to give it (the phone in question) permission one time. After that, it doesn't ask for it again. I think that's why nothing happens when you bury the connection process in an 'if' statement that it doesn't get to.

Here's what I used.

Apparently it doesn't get to the Start Scanning part.

I'm not sure if I understood correctly. There are several Android verisons like 5.x, 7.x, 8.x.
Apart from that, the minSdkVersion is not 21 when using the BLE extension:


Yes, ACCESS_FINE_LOCATION is automatically requested with Bluetooth.StartScanning.

1 Like

I have tested on other smartphone (os 11) and the error is there again.
I will try to investigare showing the versioncode.

version code detect on smartphone:
android 11 (redme note 9) = versioncode 30
android 12 (samsung s10p) = versioncode 31
I will try with trigger at 30 inside of 28

Try this one (tested on Android 9, 10, 11, 12):
BLE_permissions_allAndroidVersions.aia (191.7 KB)



The > operator will coerce the strings to numbers so what I proposed will work so long as the version number is specified as major.minor and minor never goes above 10, but 4.2.2 is not a number so the block will raise an error.

While the BLE extension does not force a minSdk, the logic of the component is written such that its blocks do nothing on versions less than 21. We didn't want to surprise people who added the BLE extension to their app with the increase to minSdk 21, especially if the BLE functionality might be optional. Of course, this decision made way more sense when BLE first came out and most phones didn't support it yet.

Of course there is a way to do it without an extension.

please help i tried your code Anke
but it doesn't list my hc-05
it exists on android and i can pair but in app inventor application it is not listed

il m'affiche le message suivant dans appinventor
Need android.permission.BLUETOOTH_SCAN permission for AttributionSource { uid = 10686, packageName =, attributionTag = null, token = android.os.BinderProxy@9e88c90, next = null }: GattService registerScanner
Note: Vous n'allez pas voir une autre erreur rapportée pour 5 secondes.

aide svp

see this thread

PS: I now moved youor question and related answers to the correct thread...

This is an issue related to the Android 12 update. The currently published BluetoothLE extension is not aware of Google's latest changes to Bluetooth, and so it fails for that reason. You should be able to use the AskForPermission block to request the BLUETOOTH_SCAN and BLUETOOTH_CONNECT permissions to connect to BLE devices on Android 12+.

Edit: I should mention that I am in the process of updating the BLE extension to address the changes in Android 12. Please keep an eye on the IOT category of this community for the update announcement.

1 Like

bravo Anke
je vous remercie pour l'effort fournis
normalement ca va bien marcher
mais a quoi sert l'extension GetApilevel1

merci infiniment

1 Like

Btw, search ...

Great, thanks, this saved me.