Need Help In Bluetooth Permission for an app on Android 12

Hi Anke
I don't know if it could help you, but you will find the two debug files , I have done, with adb you mentionned (I didn't know adb procedure ) :
One for the phone with the BTClient bug , and another one with the tablet where all is OK .Same APP of course .

logging_adb_testBUG.txt (258.9 KB)
logging_adb_testOK.txt (343.3 KB)

What I did during those test debug period is : open the APP ( BluetoothClient_AI2test_withConnection ), connect to one BT device , and stop .

I am wondering if someone else has also, like me, this new trouble with BT classic when Calling Bluetooth Client Adress finally ? Could it be useful to gather who has the same trouble and in which type of Android device ?

I also have a similar problem. The app that used to work fine 2 years ago, is not working now, after rebuilding the same .aia file today. When i click the list picker of bluettoh, the screen shows the list of previously connected bluetooth deives. And when i click on the desired bluetooth device from the list, i am getting the RunTime Bluetooth permission error. Can someone pls help me
BT_Permission_Testing.aia (2.1 KB)


I have the same problem. Please if you can solve this problem share the solution

Small update. The newly built app is working fine with Android 10.
But fails to work with Android 12

image


I updated the extension, but it's still not working

Show it, like this:

BLE version

grafik
:face_with_monocle:

1 Like

Hi all.
I'm currently facing the same issue. Trying to connect to a Bluetooth device (HC-05 module) using BluetoothClinet on my Xiomi Mi 11Tpro (Android 12, API 31) with the same result as described above.

To have a better picture of the issue below you can find screens from running the "BluetoothClient_AI2test_withConnection"

Dosen't matter what app I will try to build, I get the same result shown in the picture that appears after trying to connect.

What is wondering is why running the app requires this permission on my phone (API 31).
if I understand correctly according to the information under this link

this permission is required for the older SDK version?

Hi Anke, I have seen many of your posts giving solutions to issues related to MIT app inventor. I need your kind support here.
We need solution for the classic Bluetooth client. Here are 2 scenarios.

  1. App developed and apk built on MIT app inventor 2 years ago is working fine with Android 10 as well as Android 12.
  2. The same app is just rebuilt to generate new apk ( blocks and designer is same as that of the app developed 2 years ago). But the newly built apk is not working on Android 12 but works well with Android 10.

Hi Chris,
My first intention is to establish BT connectivity between microbit and mobile phone android 12.

If I am able to successfully send a message to mobile and can display it on label then will proceed with further development of the application.

BT version I need to check and will reply back again.

Both devices are paired with each other.

Hi anke. I haven't used the latest BLE version. Since I have built entire app based on classic Bluetooth, all blocks are using elements from Classic Bluetooth Client only.
So if i use new BLE extension, I should change all the blocks of the app.
So is it possible to upgrade the classic Bluetooth extension to solve this permission issue?

If you move on to BLE, you have to change your Script/Sketch too - it's a bit more complicated than Classic, though it has some advantages.

It's not an extension :upside_down_face:

Thanks Chris for correcting me.
Is it possible to get a simple sketch to establish the Bluetooth Scan, Bluetooth Connect, Send simple text and receive simple text. Its very useful.

There are many BLE examples across the forum. A BLE Sketch is not so simple, and if you want to both send and receive - to what extent? Define your code appropriately if your App needs to both send and receive. Think of a Bluetooth signal as water running through a pipe - it can't go in both directions at the same time.

ProfessorCad: Tips & Tricks Bluetooth
ProfessorCad: Tips & Tricks Bluetooth Failure
ProfessorCad: Tips & Tricks Create BLE UUIDs

Is that the latest version microbit?
Power User @ghica is a Microbit expert, would be good to have her opinion. At one time, App Inventor had a nice set of functions specifically for microbit but I think they have fallen behind the development of the hardware somewhat.

I understand that send and receive does not work simultaneously.
I am using this app as a bluetooth remote to control 4 push button switches connected to a microcontroller. Android app will send simple codes as (Numeric 1, Numeric 2, Numeric 3 and Numeric 4) via bluetooth to a bluetooth Module named HC-05 connected to Microcontroller. When Microcontroller receives numeric 1 via bluetooth module connected to it, if soft presses the PushButton and so on up to Push button 4.
Once the soft press is done, Microcntroller sends feedback from HC05 bluetooth module as Alphabet A (for pushbitton 1, and B,C or D up to Push button 4. This feedback is captured back in android app for confirmation.

So, the app should first,

  1. Search for Bluetooth devices.
  2. Select the Bluetooth Module HC05 from list of available bluetooth connections nearby
  3. Then send characters either '1', '2', '3', or '4' based on user input.
  4. This character is received by HC05 bluetooth module connected to microcontroller.
  5. App should receive back confirmation as 'A', 'B', 'C', or 'D' and change the label text to Push Button Pressed (1,2,3, or 4)

OK, HC-05 uses Classic Bluetooth, so stick with that.

It will be the Address listed and unlike some examples on the forum, do not modify that - App Inventor deals with it automatically.

This is the danger - you need to prevent the User from sending the next value until the receipt of confirmation of the first value has arrived - So on send, disable all send buttons, On receipt, enable all send buttons.

If you are the only ever User, that's perfectly fine - but others would find it confusing. What if I needed to send 3 again and my button now says 'C'?

Not a term I am familiar with, but I assume that a relay or similar will be triggered programmatically.

Yes its a kind of relay triggering programatically.

Chris, i have developed the sketch and program 2 years ago. It used to work fine, until i had to modify a bit.

I have rebuilt the same sketch and understood that i am getting bluetooth permission error on android 12, but works fine with the android 10.

How do i solve the permission error on Classic Bluetooth client.

Have you tried:

blocks