Beta version of BLE extension for Android 12 permission changes

Hi Evan and Chris, I have figured out a way to solve this Bluetooth Classic Permission Issue.

  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

1 Like

Even with the latest version of apktool it is not possible to set compileSdkVersion=31:

It seems to be related to aapt2.exe (aapt.exe) - I'm not sure... :woman_shrugging: :thinking:
Please any tip/hint that might help?

If you set the targetSdkVersion=29 the app (APK) will not allowed by Google (in the Play Store). The minimum targetSdkVersion has to be 31.

BTW... (see here):

1 Like

Hi Evan,
Part of this release, what's the chance to fix the AdvertismentData block?
This module return null, seems it was never works.
I need it for some IOT class.

THX
Ziv

Hi Evan, hope your brain is suitably refreshed after your short break :grin:

Re my Post#20 in this topic:

To prevent the BLE Device List becoming so large it slows the Smartphone down or crashes the App, we need a new function that filters devices found and only adds them to the BLE Device List if a specific string exists.

i could use scan with @Anke 's way that set "scan block" dummy for get connect permission in running!

but still "advertising" is not working.

it showing always "false" in result.
can i make it working with any ways??

You are using Kodular. (You should ask there.)
Did you try it on AI2 too?

yes and tested with after get "connect" permission.
still giving "false"

blocks

i didn't use APK studio. must i?

I've been out for the past week, but I'll try to see if I can get this onto my calendar for this week.

1 Like

then, is it mean no way to use "advertisement" for now? (without APK studio?)

thank you for your support :slight_smile:

sorry but i tried with AI2 first, and i hoped its work with kodular and tried. so screenshot was.
whatever both are not working.

to start scanning and immediately trying to connect to a device does not make much sense, does it?

Unbenannt3

try to use the DeviceFound event to connect
Unbenannt2

Taifun

it was just for dummy for get permission when first run.

sometimes its asking permission when the just openned first time(without any actions), but sometimes its not asking. so i made button to activate. i don't know actual condition of these differences but i guess its from minimum SDK level or just AI2<->kodular build conditions.

ofc im using as you shown for event to find devices.

the problem and my purpose is to make permission for "BLUETOOTH_ADVERTISE".

thank you :slight_smile:

1 Like

... that should be the Classic BT BluetoothClient block, not the BLE block, as per Anke's post.

You should then place a .Connect block in a way (unobtrusive and separate from your blocks/procedures) that avoids a Connection error / ConnectionFailed.

do you mean like perfectly seperated, cannot use?

whatever it worked :slight_smile:

maybe ewpatton fixed it

grafik

And this procedure, of course, is not used anywhere.

then it was right. thank you!