Adding new permissions to use BluetoothLE extension

So I was using the Bluetooth LE extension from here and one fine day the apps stopped working. The error message was as shown below:

So I unpacked the apk and went through the permissions requested by the app in the manifest file


Sure enough no signs of Bluetooth scan permission. I added scan and connect permissions as below and packed the apk back.

On reinstalling I got new permission option of nearby devices enabling which restored the BLE functionality as it was before!

What do I need then? Is there a way to include these permissions in manifest file automatically? The ask for permission method provided by screen does absolutely nothing to the manifest file.
P.S. I am using pixel 4a running android 13

1 Like

Hello Vibhore,

Try dragging this extension additionally into Screen1 and also requesting the permission with the AskForPermission block. There are no blocks in this extension, just drag it into the Viewer.

com.gordonlu.BluetoothScan.aix (4.7 KB)


I may be doing something wrong here but the blocks won't snap!

You manually insert a text block with "BLUETOOTH_SCAN" (without quotes) into the socket. However, you still need to keep the extension I made in the previous post in Screen1.

Thanks Gordon as you pointed, I did the same and yes! I got the scan permission in the manifest file. I need to probably write "android.permission.BLUETOOTH_SCAN"

Can you provide another extension for "BLUETOOTH_CONNECT" permission as well. Sorry for asking too much help but I am not familiar with how to make .aix file.

Appreciate your help!

Update:
Using the following blocks of code


I am only getting

Need to find a fix so that the permission is set to "android.permission.BLUETOOTH_SCAN" instead of "BLUETOOTH_SCAN"

2 Likes

The BluetoothClient component should add the BLUETOOTH_SCAN permission, so I'm not sure that an extension is needed for this.

2 Likes

I didn't realize that. Thanks.

2 Likes

@ewpatton @Anke Thank you for all the help, you are right. As soon as I added BLE client extension to my app, all the permissions were added. I hope the Bluetooth LE itself can do the same thing as I am not using any procedure from Bluetooth client extension (not directly at least) and only utilizing Bluetooth LE extension.

Thanks again and cheers! :smiley:

1 Like

... and the BLUETOOTH_CONNECT permission.

1 Like

Sure, but depending on how the BLE extension is being used either one or both might be needed. In the update I am working on to the BLE extension, the SCAN permission will be included if StartScanning is called and CONNECT will be included if any of the Connect methods are called, so in theory the system should be slightly more intelligent about it than just blanket adding all of the Bluetooth permissions.

2 Likes

Ok, so the SCAN and CONNECT permissions are automatically only requested and granted when needed.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.