Beta version of BLE extension for Android 12 permission changes

You should then place a .Connect block in a way (unobtrusive and separate from your blocks/procedures) that avoids a Connection error / ConnectionFailed.

do you mean like perfectly seperated, cannot use?

whatever it worked :slight_smile:

maybe ewpatton fixed it

grafik

And this procedure, of course, is not used anywhere.

then it was right. thank you!

Thanks.
If you need beta tester, let me know.

Hello,
I have read 4 threads regarding the connection issue which is from the latest version of AppInventor.
I worked on a mini program on Feb 15, 2023 which worked perfectly. Today it shows the error message:
" Need android.permission.BLUETOOTH_SCAN permission for AttributionSource { uid = 10267, packageName = edu.mit.appinventor.aicompanion3, attributionTag = null, token = android.os.BinderProxy@76115b5, next = null }: AdapterService isDiscovering "

I tested the same mini program on the AppInventor beta version the message is identical.
I also added the extension :
Bluetooth Low Energy
Extension Version: 20230223-beta
Date Built: 2023-02-23
=> Same error message. I'm at an impasse.

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

Hi
It would be nice, and Solve a lot of issues, if the Raw Data Advertized could be extracted witout having to read or know the UUID. Legacey BT Adverts do not have to have a UUID data. The Raw data ( max 31 bytes) is denoted only by Length ,Type , and Data, in the message etc. And is made up of Concatinated types. For e.g. the RAW data comming through is 0x03094145020106020A03 First Part 03,09,4145 - Length=03, Type = 09 = COMPLETE LOCAL NAME and The Name is 4145 = "AE" then L=02 FLAGS=01 , Bit field = 06 (connectable) next is L=02, TX Level= 0A and 03 is the Strength. Then other data such as windspeed or humidity whichever type that is as per BT message defs.

Please implement a block .Advertisment.rawdata.(DeviecAddress) or (Device name) or both as inputs. Yo will solve 90% of peoples problems receiving Ads.

Cheers Robin

I: Using Apktool 2.9.3

I: Copying C:\Users\teknofest tak�mlar�\AppData\Local\Temp\apk-editor-studio\apk{0919b5e1-02fb-4a22-af87-ed213fe1408a} classes.dex file...

I: Copying C:\Users\teknofest tak�mlar�\AppData\Local\Temp\apk-editor-studio\apk{0919b5e1-02fb-4a22-af87-ed213fe1408a} classes2.dex file...

I: Building resources...

W: C:\Users\teknofest takımları\AppData\Local\Temp\apk-editor-studio\apk{0919b5e1-02fb-4a22-af87-ed213fe1408a}\res: error: failed to open directory: Sistem belirtilen dosyayı bulamıyor. (2).

brut.androlib.exceptions.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\TEKNOF~1\AppData\Local\Temp\brut_util_Jar_40036004054003833582344835545103198213.tmp, compile, --dir, C:\Users\teknofest tak�mlar�\AppData\Local\Temp\apk-editor-studio\apk{0919b5e1-02fb-4a22-af87-ed213fe1408a}\res, --legacy, -o, C:\Users\teknofest tak�mlar�\AppData\Local\Temp\apk-editor-studio\apk{0919b5e1-02fb-4a22-af87-ed213fe1408a}\build\resources.zip]

I made the necessary changes in the permissions for the apk. But apk editor studio gave errors. What should I do? @Anke