Hc-05 is classic BT indeed. But both BT versions could use some more attention.
I was referring to this app:
Apparently I've slowly lost track of what this is all about. No wonder after more than 120 posts.
Try this one (on Android 12+) → Companion & APK:
BluetoothClient_perm.aia (9.8 KB)
And post screenshots after running Companion & APK.
Companion should look like this:
Try logcat to find out more
Taifun
Hi Anke.
seems that I have the same problem as Madhav, so I tried to run Your BluetoothClient_perm.aia
Below you can find a screenshot after running app.
Then I add a simple block to connect with my Bluetooth module HC-05 (Classic Bluetooth), shown below
When trying to connect with my HC-05 module that is available on the list with BT devices, I'm getting the same result/error as in all my application that was working a couple of weeks ago. Error shown bellow.
Is there any solution to this issue? What I'm doing wrong when trying to establish the connection (basing on .aia that you shared) ? Thank you in advance.
This appears to be a common issue with Xiaomi's Bluetooth implementation in Android 12, as it has been reported a number of times on StackOverflow (e.g., 1). We are discussing next steps to take in this regard.
@Anke True. It doesn't seems to work on Android 12 phones.
Now it seems I am lost my way how to send message from microbit and received & display it on mobile (mit app).
If this doesn't work then I cannot proceed further with my application for the competition.
@Ghica Can you please tell me what all application you've shared works on which Android version? Does it work on Android 10 with message communication from microbit to mobile?
Thanks in advance.
@ChrisWard @Anke @Ghica
@Anke I tried using latest version (BETA) of BLE but I am not able to get the microbit listed after scanning the device.
I also have the same problem as many others.
Bluetooth Classic
Connecting to a ESP32 microcontroller
The same apk built 15 dec 22 is working, but when rebuilt today I get Bluetooth permission error.
@ewpatton , I have a Sony Xperia phone with Android 12, so it's not just Xiaomi's...
The Xiaomi 13 Pro has a BLE v5.3 chip
The Sony Xperia 5 IV has a BLE v5.2 chip
So both very up-to-date
This is not an issue of the hardware stack. The issue is in the software stack. We followed the Google guidance on the matter and it worked when we tested it on Google and Samsung devices, which is what we generally use when we conduct our workshops. I also verified by looking at the Android 12 sources from the AOSP repository and the various methods we use in the BluetoothClient are annotated correctly regarding permissions. The fact that some manufacturers' builds of Android 12 are asking for the old Bluetooth permission indicates a problem from their end, and my development experiences suggests that it was likely a poorly resolved merge conflict, resulting in the removed permissions being restored incorrectly.
In the meantime, we've relaxed the maxSdkVersion constraints for these two permissions on ai2-test.appinventor.mit.edu. Folks encountering errors for android.permission.BLUETOOTH on Android 12 can try loading and building their projects there.
I had no luck in the test-platform either.
This is my prg:
(The working project from 3 months ago didn't ask for the Bluetooth_scan, only Bluetooth_connect; I don't need the scan functionality, just trying different things to make it work as before, I only need to edit the text of some lables otherwise the working build from last year would be ok for me)
BorrmaskinHMI2.aia (77.2 KB)
Only builds will have the problem fixed. Did you try to build your app?
Yes I buiilt it to an apk and downloaded to phone via qr-code.
When building in the test environment I get a couple of warnings about it's a dangerous app, do you really want to install etc.
I get two questions about permissions when the app is started the first time. "Do you want to allow finding, connecting and determine relative position to devices close", and then the same question one more time. (My phone is in swedish so i'm not sure about exact wording)
I allow that, but then when I pick a device to connect I get the lack of permission Bluetooth error.
Try this test APK and post a screenshot after the first run:
Hi Patton, I tried this. Built the app, downloaded and installed on my Xiaomi Note10 Pro. But the issue still persists. Lacks Permission android.permission.BLUETOOTH
Hi Anke, may i know what are we testing by running this app. It runs fine on my phone without throwing any error while selecting the desired bluetooth. But it doesnt connect to the bluetooth. But what does it prove.
It should show that both permissions are granted correctly. So please post a screenshot.