Error 908: The Permission BLUETOOTH.CONNECT has been denied (android 11)

I know this has been asked before, but none of the solutions suggested previously are working for me.

My code is below. When running on an Android 11 tablet I get the error "Error 908: The Permission BLUETOOTH.CONNECT has been denied".

Everyone has suggested giving App Inventor Permission to "Access Nearby Devices" in settings. However, when I go to settings on my tablet, there is no option to give permission for bluetooth or "nearby devices". What the heck? Screenshot below of my permissions for AppInventor.

Does anyone know how to turn the permissions on in Android 11? This is so frustrating...

Why a screenshot of the companion app?
Did you build your app and test the apk file?
Taifun
.---

(Canned Response ABG - Bluetooth non-BLE SCAN Permission Blocks)

The easiest solution, for immediate relief
(from @Barry_Meaker) ...

I had the same issue. The problem is your app does not have permission to see nearby devices. The solution is to give your app permission on your phone (no code changes in your app).

on your phone,

  • goto settings
  • search for your app
  • in App Info for your app select Permissions
  • change Nearby Devices from Not Allowed to Allowed
  • Done

By the way, the very first time you run the app, Android will ask if you want to grant the app this permission. If you say no, or ignore the pop-up, the permission will be set as Denied. Android will not ask again.

A more complex approach, for professional app development:

See Bluetooth liste of devices deosn't work anymore - #7 by Anke
Special note for Xiaomi devices:
I have an error with bluetooth on android 12, Xiaomi Poco X3 NFC - #20 by Patryk_F

1 Like

The screenshot is to show that I do not have the option to give bluetooth permission to the app. I am trying to follow the instructions you posted, but it never asked me for Bluetooth permission and there’s no option to add those permissions in settings.

I have not built an APK file yet, just running it through the companion app.

Hi Taifun,

I have now tried building the APK file and installed the app, but I still get the exact same error. I have tried to follow your instructions for allowing Bluetooth permissions in settings on the tablet, but please see the screenshot below. The Permissions setting is grayed out saying no permissions were ever requested. How can I grant the app the permissions for Bluetooth then? I don’t understand.

Try the 2 test projects from here

Taifun

There are no

- <uses-permission android:name="android.permission.BLUETOOTH"/>
- <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>

permissions on Android < 12, so these cannot be requested.

As @Taifun said, try my BTclient_test2.aia. Build the APK and test...

Hi Anke,

I tried both and neither one worked. I don't get the error message anymore, but the list of bluetooth devices does not appear. Here is a screenshot of the app, in both cases it looks like this:

If it's not a permissions issue, then do you have any idea why the list of devices is not appearing? I am able to connect to my arduino with the LightBlue app, so I know bluetooth is enabled and working on the tablet.

Also Anke, I should mention that I found another thread where you posted a file called:
"BLE_permListDevConnect_allAndroid_2023728.apk" and that one actually did work. I can see and connect to my Arduino with it. Would it be possible for your to share the code for that project so I can see what I am doing wrong in mine?

-Rox

grafik

I'm reluctant to post an AIA in such cases because most people then make their adjustments and then claim it doesn't work. The fact that adjustments have been made usually only becomes apparent after long negotiations and many unnecessary posts. Therefore I prefer to post APK links.

Here are my blocks:

and here are the used extensions:

Hi Anke,

Yes I am referring to that App. I used it to connect to my Arduino, so I know bluetooth is working on the tablet. Do you have any idea why neither my code nor the two projects you posted above are working to show the list of Bluetooth devices?

-Rox

Ok, thank you! I see the problem now. My code was using a regular BluetoothClient instead of the BluetoothLE from the BLE extension. I didn't realize they were different! I just wrote a new code with BluetoothLE and it is able to find the device and connect.

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