Beta version of BLE extension for Android 12 permission changes

test.aia (250.2 KB)

Try this and post screenshots.

I tested your app apk and put the result without the other thread.
Regarding the bluetooth problem with Android 12, how can we get around the blockage?
This work is a school project and I have to find a solution to overcome this dysfunction.
I tested the application with an old tablet under Android 4, same error. What workaround can we use please?

I tested your app apk and put the result in the other thread (sorry).

I use the Using the beta .aix and testing with issues on Samsung Galaxy S6 Lite running on Android 13


. Please have a look.
BLE_Beta_20230403A.aia (294.5 KB)

Here are additional screen shot and the video capture


Version 20201223 is working. Beta not working

Phone model:
Xiaomi 12T Pro
Miui 14
Android 13
Problem: it can scan for devices, but won't connect. tried connect with index and connect with mac.
errors: "Connection timeout", "connection status was set to OS code 4"

Phone model:
Xiaomi Mi6
Lineage
Android 10
Problem: it can scan for devices, but won't connect. tried connect with index and connect with mac.
errors:
"Connection timeout", "connection status was set to OS code 133"

version 20201223 here is binding on both. I haven't tested sending and receiving data yet.

My code blocks are as in the standard recipe.

Here is an updated beta version of the BluetoothLE extension. Unfortunately I haven't had a chance to test this on an Android 12 device yet, so make sure to back up your projects before you upgrade.

edu.mit.appinventor.ble.aix (202.1 KB)

1 Like

Hello,

Is the source code available for the bluetoohLE beta extension? I have found some source on GitHub but it looks pre-beta.

I want to look at possibly changing it to run as a background task as my app needs to communicate with BLE devices as a background task.

Thank you friend

I am correctly advertising out of my app. But to read incoming advertisements to my app, I am doing this (in an Android 13 device):
image

Which gets me either this error:
Attempt to invoke virtual method 'android.bluetooth.le.ScanRecord android.bluetooth.le.ScanResult.getScanRecord()' on a null object reference
Note: You will not see another error reported for 5 seconds.

Or "null" is updated in the text.

The deviceAddress should be the one for another phone of mine or a laptop I have here, and the serviceUUID is the one in an advertiser I'm using in the "nRF connect" app.

I can provide more information to help troubleshoot.

I see the command I'm using is call BluetoothLE.AdvertisementData, but some BTLE apps call that field (or a related one, I'm just learning about this as I go) as "ManufacturerData". Hope they both refer to the same field. This is an example C# BTLE app from Microsoft which does that