Error 908: the permission bluetooth connect has been denied. please enable it in the settings app

Android version: 13

(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:

These blocks can be dragged into your Blocks Editor to request permission(s) for Bluetooth non-BLE scanning and connecting. All three parts are needed.

You also will need to pull in TinyDB into your project.



When Permission Granted (@Patryk)

Thanks to @Anke for the original code.
My changes include

  • use of the Screen1 permission blocks to avoid the possibility of a typo
  • using a TinyDB tag particular to BT permissions and only for BT permissions.

(Thanks to @Patryk_F for correction to grant order)
Special note for Xiaomi devices:
I have an error with bluetooth on android 12, Xiaomi Poco X3 NFC - #20 by Patryk_F

I did that, but no change

i am not professional app developer.

My aim is to connect two (for now) BLE esp32 to one android app.

my phone is: Samsung SM-A045F

You sure? Please show your new blocks.

When i try this one, there is no any device shown, "Status: scanning"

If you enabled the permission in Settings this should work. If it still doesn't, for whatever reason, try the blocks in my post.

BTW, BluetoothClient is work.

is it for BLE? i did not find some of the function, i.e. call.SroreValue...how about the pair key?

BTW, I would like to thank you for your support!

when i add BluetoothClient1 the error massage is disappear, but not show list of Bluetooth devices

Use the latest version of the BLE extension

Taifun

I used 20230728 which is not work, let me try the old version

No change, i also used the latest version.

does a BLE device must be exist to show in the list?

The good thing about your question is that you asked it yourself.

(It probably makes little sense to test a Bluetooth app alone in the forest. :wink:)

2 Likes

haha,... I mean I have esp32 worked for BluetoothClient1. does the esp32 must configured for BLE?