Android permissions - BLE - Android 12

I can't check it because I have none of them.

@Ghica as in my microbit, I try to show Smiley led pattern if BT is connected, which is successful. The microbit and mobile gets paired and connected successfully.
I've done a lot of debugging as a software developer, but I am totally new to using microbit and mit app, so not sure how to debug the blocks and check whether they are getting activated or not.

If you can tell me how to debug microbit and mit app block, surely I will check that and post all the updates ASAP.

Which is not in the drop-down 'all categories' list........

Download the latest MIT BLE Extension: Version: 20230223-BETA Released: 23-02-2023 Package Name: edu.mit.appinventor.ble-20230223-beta.aix

Anyone having a problem with the latest BLE extension (edu.mit.appinventor.ble-20230223-beta) should post a screenshot of this APK:

Try this one and post a screenshot after the first run & after pressing "Start Scanning":

https://drive.google.com/file/d/1uGg-t4S1Nq7QzzA7iVDnOu39EFkK6als/view?usp=sharing

And again: The Location sensor must be enabled in the device settings!


We'd like to know which Android version and device you might be having an issue with.

1 Like

Hello my dear friends!

I found the error uid 10312 pid 15549 lacks permission android.permission.bluetooth on the XIAOMI NOTE 10 Pro phone.

Previous solutions work with other phones, but not with this one. I found a solution on flutter - Got "lacks permission android.permission.BLUETOOTH" on Specific device after android 12 update - Stack Overflow but I can't apply it in MIT App Invertor.

It works on other phones.

As I said, post a screenshot of my test APK (→ post #68).

Hi Anke - your build server solution works fine for me on some Samsung devices ...

Anyhow - how can I implement now what you have done in the apk in my own application ?

Hi-all
Happy to play with BLE and APP INVENTOR
I follow your explanation to create a BLE client on my android
My app is working, i can see my BLE Device in the BLE ListView
Unfortunatly , when i select my BLE device and when i click on "connect" button
the status come from connecting but immediatly to Disconnected.
I don't know why ? how can i debug that ?

I try the same with an app called nRF logger it is working properly

I saw that BLE 2023 is available to download fyi i used Extension Version: 20200828
Where can i find the last version BLE 2023 ?

It seems that i am in Android 13

Thanks
BLE_permissions_allAndroidVersions-2.aia (192.8 KB)

A beta version of the BLE extension with support for the Android 12+ Bluetooth permission changes is available here:

Hi ewpatton
I hope your are fine !
I already updated my built bluetoothLE => 2023-02-23
My app is finding all bluetooth device .
I choose the BLE Device , click on "connect" button, state is becoming "connecting" and just after become "disconnected".
Need your please help to debug that
Is it possible to have a debug info with BLE connection ?
thanks

Hi Benoit,
It looks to me that you are asking for too many permissions. If I underestand the description in the doc. right, you should use the permission denied block and there ask for the denied permission, and then wait until it is granted.

I am also on Android 13 and I had not problems connecting to my micro:bits, without asking for anything. What is the BLE device you are trying to connect to?

Hi Ghica,
Thanks for your help !!!!
I don't know why but i erased all and restarted my project.
It is now working very Well
to summarize i am try to do a test from an android phone with BLE to light on or off an LED plug on a ESP32.

I can share my code if you want
Best Regards

I am happy to hear that. I am trying to do something similar with an ESP8266, but it is using wifi.

There is sometime very strange.
I can see my BLE device.
I can connect to the BLE Device on my ESP32.
When connected i can switch on / off a LED.
After that i click on "Disconnect" button.
My Status is deconnected.

However, at this point if i click again on scan, i can't see my BLE ESP32 device.
The only solution is to reset the ESP32 and after reset ,
i can again scan, connect i can switch on/off the LED.

Do you know why i must reset my esp32 ?
maybe when a device was connected, "Advertising" need to be restart ?!!

You need to clear the Device List in your App before scanning again, or better still just set aside the address of interest as a variable, no re-scan required:

Blocks

If you download this it works flawlessly. Thanks

Anke,
You nailed it on the head with this one! permissions are great now.
all we need is for BLE to work with iOS app inventor now so we can control Arduino with app inventer.
thank you!