Need Help In Bluetooth Permission for an app on Android 12

Can you pls send the .aia file

Hi all.
Just to confirm Madhav case. On my side, building the app in a test environment and installing it on mobile also lead to the same resoult.

Scren after running the app

Then after trying to connect to one of the device from list

As mentioned earlier, I'm working on Mi 11T Pro and to connect with the BT device, I add this simple block to the app
block

Anke's test (apk) above is working nice. The error in my app shows up when connecting.

After reading the whole thread I see that there is no clear solution. I had a functional app on my device, I updated it and when I downloaded it again, the problem mentioned here appears and I did not find any solution. What a pity, hopefully it will be solved soon.


This is a picture of the error.

Hi Fabio,

If you do not wish to place the app on play store, then there is a solution to this issue. Pls see my post no 105 on this thread.

Yes I actually tried. But it appears a problem with java when I try to open de APK on the program. Later y will publish a screenshot, but I think it's not mi problem because I was following your steps, but thanks anyway.

Here is the problem, I just dowloaded the apk from MIT as you say. Open the program and select the file, then the app shows me this error:


And with this problem i cant open contents to continue following your steps.

Hope the JAVA is installed and is updated

I'm also encountering the same problem "UID 10718 / PID 5169 lacks permission android.permission.BLUETOOTH". As a Smartphone, I'm using a Xiaomi Poco X3 with Android 12 and MIUI 13. Till almost 18th February (also when this discussion was created) everything was working fine without a problem. Then maybe MIT had an update? After that, I encountered the error above.
I gave the app all permissions I need (it was working though), so I looked at the AndroidManifest.xml (see Post #107) from my working apk (before 18th February) and the new build apk from today. Both xml-files are almost the same, but with two differences.
On my working apk all permissions look like this:

<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

And on the new apk the permissions are given like this:

<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:maxSdkVersion="30" android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:maxSdkVersion="30" android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

In the new apk, the permissions "BLUETOOTH_ADMIN" and "BLUETOOTH" are set to the maxSdkVersion 30. After I deleted those both, I installed the apk and it was working for me again. So these both maxSdkVersions are causing my problem.

1 Like

Hi Darexsh

Thanks for your interesting notification : I have the same analysis than you and same symptom.
I guess that the problem occured with the introduction of nb191 of the 17th of February.
In the nb191 release it is mentionned " * Add new Bluetooth permissions to permission helper block" and in bug fixes : " * Ask for dangerous Bluetooth permissions in Android 12 (affects BluetoothClient and BluetoothServer)" . It could be there, I guess ?.

I tried now a test program with the ai2Test 20230301 as proposed by @ewpatton in #131, but the bug is still there when I connect the BT classic.
Unfortunately my present option is still to modify the androidmanifest.xml as @Madhav explain us in #106.

We have updated the build servers for ai2-test with another potential fix for the Bluetooth classic permissions for Android 12 devices that are not following the Google guidance on the legacy BLUETOOTH permission. If you try building on that server, I also recommend you uninstall the previous build of your app from your device just to be sure that the new build is installed correctly.

1 Like

@ewpatton Thanks. I just checked and can confirm, that in my case building the app in ai2-test after the build servers update solved the issue on my side.

@ewpatton thanks a lot! I can confirm that it is working now again with my Xiaomi device!

Buenas tardes sigo intentando retomar mi trabajo pero cuando género la app en el servidor "normal " en el servidor normal sigue apareciendo el error , he intentado como otros miembros de este chat con el servidor para test y me da este error

Si género la .APK con el servidor " normal " me sigue dando el error

Muchísimas gracias por su ayuda y su interés

Dear Madhav,
Thank You so much for your help. I mark this as a solution as it works perfectly for me.

I have a Mi 10T Lite with Android 12 and MIUI 13. I completely deleted the Mit AI2 Companion application and reinstalled it. I recompiled the apk that calls an ESP32 board and it still doesn't work. But I noticed something interesting, an application compiled before the problem appeared works fine. I think that if I will recompile it, it wouldn't work, but I don't dare to do this.
So, I think the problem is still there with MIT App Inventor. Ask me if you need more information.
I solved my problem (not very elegantly by modifying the androidmanifest. Anyway, I have no intention of uploading the apk to Google Play. Thank you.

We did not rebuild the companion for this test, only the buildservers on ai2-test were replaced. The companion will still have the restriction that is affecting certain phone brands w.r.t. the old Bluetooth permissions.

Did you recompile on ai2 or ai2-test? Only the latter has been adjusted to drop the maxSdk constraint on Bluetooth permissions. I just built an app on the test server and can confirm that when I dump the AndroidManifest it has both of the old Bluetooth permissions without restriction.

Hi!
I have built a project that displays sensor parameters read from PSoC 6BLE. I am getting Error 9101 in BluetoothLE extension: Expected device index from 1 to 0. Do you know how to solve it?

Post screenshot(s).

Show your (relevant) blocks (and post the aia & also a screenshot of the error).

1 Like

Thank you for your reply, I have solved the problem of error 9101. However, can you guide me to build a project that displays the sensor's parameters?