Need Help In Bluetooth Permission for an app on Android 13

Hi ChrisWard,

My android Version is 13, i got this message " Need android.permission.BLUETOOTH_SCAN permission for android.content.AttributionSource@1c63b490: GattService registerScanner "
After seeing your reply i edited the app then it worked find and connected to the microbit.

The problem is that, when i tried to send command to the microbit, i get this msg "6e400001-b5a3-f393-e0a9-e50e24dcca9e, characteristic 6e400003-b5a3-f393-e0a9-e50e24dcca9e are not published by the connected device"

Any help would be appreciated

Hello Essa

Please do not private message the Power Users directly unless invited to.

  1. We are a small team collectively supporting thousands of Users
  2. The person messaged could be unavailable for days or weeks and the message left unread.
  3. By keeping the discussion on the forum, there are many people from all around the World (different time zones) who can potentially help you, not just the first responder, who may be unavailable. Plus, there is often something that many forum members can learn by reading the posts.

Spot the characteristic error:
Drawing1

If this does not fix the issue, post your App Inventor Blocks, your micro:bit script and the model + version number of both your Android device (phone) and your micro:bit

Use the latest version of the BLE extension
See also the announcement

Taifun

1 Like

Hello ChrisWard
Sorry for the private msg. After sending the msg to you the next day i tried the app again and the wrong msg gone without editing or adding any blocks about UUID.

Other than a extension update, did you change anything else permission related?

I am encountering a BLUETOOTH_SCAN permission issue and all my code blocks seem to be similar despite updating to the newest version of the extension.

Hello Warbirdguy1

We are not the source of the changes, it's Google's added security measures in Android. When requesting permissions, you have to be aware of the Android version. It it's only for your own use, no problem but if you distribute your App, it needs to 'ask' the device what Android version is running :face_with_monocle:

You can use the permissions block to request BluetoothScan permission. Your code should not assume that the User gives that permission, so always start the main code rolling after permission success.

1 Like

So is everything OK Essa? You should install the latest BLE extension.

Sorry for post delete, I could not find out how to edit it.

Could you look at the below and let me know if anything jumps out as incorrect?

I am still getting the BLUETOOTH_SCAN permission denial despite manually allow BLE permissions in settings.

Your blocks look fine
Most probably you do not use the latest version of the BLE extension...

Taifun

Based on my understanding this the latest extension.

I updated older projects to this one shortly after it came out.

I even started new projects and with the newest extension below and the BLUETOOTH_SCAN fail results are the same.

extensionVersionNew

Hello ChrisWard,

I chose "connect AI Companion" the app run on my 13 android version phone.

After building apk app and installed it i run into problem :relaxed: im gonna try the new extension.

The new version of the extension is important. Sounds like the issue is likely to be a missing permission.

Are you setting Fine Location before requesting Permissions? You can trigger Location by dragging a Location component (unseen) onto your Screen.

BLE ANDROID 13 PERMISSIONS RESOLVED!

I apologize for the very late reply. I was in the process of moving and all development ceased for a while.

I did not realize you MUST include BOTH BluetoothLE and BluetoothClient components. I was only using the BluetoothLE component.

ble and bl Modules

There is an updated BLE Extension Warbirdguy:

I have been using the BLE extension in the below date code for quite some time. Copied from my project.

Extension Version: 20230728
Date Built: 2023-07-28

EDIT: The BLE function is only access on Screen2 of my application. In case that is relevant.