Need Help In Bluetooth Permission for an app on Android 12

Hi Chris, I followed your instructions. But still the error persists.
I do not know what mistake am I making.


No Block asking for permission?

Side note - having the scanned addresses go straight into the List component could omit devices that have not been discovered yet. It's usually a good idea to use a Clock timer.

Thanks @Ghica I will try your apps tomorrow morning.

Hopefully your apps will help me to send message from microbit to mit app (mobile) and display it in a label.

Hi Chris, I have added the block for permission, but still the problem exists.

@Ghica @Anke @ChrisWard
I am trying to use applications provided by @Ghica (reference: App Inventor, Micro:bit and UART)

It seems like it does not support Android 12, as blocks for BLUETOOTH_CONNECT and BLUETOOTH SCAN are missing.

I added the blocks for the same in the mit app.

But getting errors:


Refer to the updated mit app:
BTReadWrite.aia (296.0 KB)

Help to resolve these issues for BT connectivity.

Android mobile version 12

Thanks in advance.

And again and again and again ... :woman_shrugging:
Use the current version of the BLE extension!

See post #73.

BLE version

Uhhh Ohhh!

Sorry I missed out on updating BLE extension.

Thanks for the response.

I will keep this in mind... ( :wink: :wink:)

Sorry, I may be stupid, I intended to update my tutorial this morning, but where is the updated extension??

Another point, you may wonder what the webviewer running JavaScript is for in my example. It is needed because there is still no way to convert the Ascii you recieve from the micro:bit to characters AppInventor can handle. So, if you want to display your text in your label, you better use this.

1 Like

I tried this (and removed the Location permission in the Manifest) to get rid of the Location permission / request, but it doesn't seem to work (on Android 12+):

<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
                 android:usesPermissionFlags="neverForLocation" />

I am not really sure what I can do, except buying a new phone :frowning:
But the real question is what is @Sudarshan_Gupta able to do.

And again, he should use the current BLE version.

Hi Mohit, I was able to solve the problem of Bluetooth Permission error.

  1. Build the APK file from your project in MIT APP inventor.
  2. Open the AndroidManifest.xml file to modify the permissions.
  3. Delete all permissions related to BLUETOOTH and add 3 lines.

  1. Save the AndroidManifest.xml file with above changes.
  2. Rebuild the APK file.

NOTE:

  1. How to view the AndroidManifest.xml?
    ------ Download APK Studio Editor from the link Download APK Editor for PC and Mac – APK Editor Studio
    ------ Open APK Studio Editor and Open the APK file.
    ------ Click on the "Open Contents" tab
    ------ Folder will be opened and "AndroidManifest.xml" file can be seen.

  2. How to Edit AndroidManifest.xml file?
    ------ Open the AndroidManifest.xml using any of the text editor.
    ------ Delete the lines related to Bluetooth related permissions.
    ------ Paste the below lines and save the changes.

  1. How to Rebuild the APK
    ------ After following the Step1 and Step2, On APK Studio Editor, Click on "SAVE APK"

Now, install the APK on mobile and Check the Bluetooth Permission Error Should be gone

3 Likes

Hi Madhav

I confirm that it s works for me . I changed the androidmanifest.xml , exactly as you perfectly explained us, with APK studio Editor .
I delete all line with mentionned bluetooth permission and changed at the beginning with your :

even if it is not necessary very pratical so far, many thanks to you

which means, you will not be able to upload your project to Google Play
Taifun

1 Like

Hi Taifun,

Thanks for letting know about this. I'm aware you have built your own extension for Bluetooth client. I believe you have enough info and means to solve the issue. Can you please help us.

that is true Anke.
I just tried the same but with targetSdkVersion="31" instead, and the bug is there again with the pop up : "need android.permission.BLUETOOTH_CONNECT .... "