My APP was working OK until I updated my phone to A13.
Now, Bluetooth activity in the APP requests a permission for Bluetooth-Connect.
My original APP had no Bluetooth permission related blocks and was working OK.
Runtime Error
Need android.permission.BLUETOOTH_CONNECT permission for AttributionSource { uid = 10382, packageName = edu.mit.appinventor.aicompanion3, attributionTag = null, token = android.os.BinderProxy@1cdc6c9, next = null }: AdapterService getBondedDevices
*Note:* You will not see another error reported for 5 seconds.
AI2 version info indicates support of Android12:
Built: October 19 2022 Version: nb190b
Use Companion: 2.65 or 2.65u
Target Android SDK: 31 (Android 12.0)
BLUETOOTH_CONNECT permission does not appear in the Screen1 permission request list.
The existing permissions for "Bluetooth" and "BluetoothAdmin" does not make any difference when I add them to my code.
I have reviewed the Bluetooth related postings, tried adding the Client as an additional component as described in some postings. Nothing sees to make a difference in eliminating the error.
Can you confirm if this is an Android version support issue or something else ?
Thanks
I am not using BLE, just the classic BT; so I did not think the first reference applied to my problem.
Anke's solution shown in the second reference makes use of a permission that does not show up in my "call Screen1 for permission" block; so I do not know how to make use of it. Here is what my call block displays:
With that permission in code, an Android message appears on the phone and upon confirmation, the permission is granted; and the program Bluetooth features work OK.
I can generate an APK using the new server and wait till the changes appear in the live version.
Hello all,
I have the same problem. Receiving data from ESP32 worked fine for a while with Android 12 and 13.
Now it still works with Android 12, but shuts down inventory app on Android 13 as soon as I execute BluetoothLE.Register for Bytes.
I once got a message: **Service nnnn-nnn-nnn-nnn-nnnn, characteristic 8f1fa29c-210b-11ee-be56-0242ac120002 are not published by the connected device?
The BLE Device is initiated "normally" with:
> pServer = BLEDevice::createServer();
> // Create the BLE Service SERVICE_ECG_UUID
> BLEService *pServiceEcg = pServer->createService(SERVICE_ECG_UUID);
> // Create a BLE Characteristic
> pCharacteristic = pServiceEcg->createCharacteristic(
> CHARACTERISTIC_ECG_UUID,
> BLECharacteristic::PROPERTY_NOTIFY
> );
> // Start the service
> pServiceEcg->start();
> // Start advertising
> BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
> pAdvertising->addServiceUUID(SERVICE_ECG_UUID);
> BLEDevice::startAdvertising();
...
and still works normally on Android 12, but no more on Android 13.
Anybody any idea?
I'm not very familiar with arduino codes. In any case, the characteristics must be the same in both the arduino and the ai2 block. We don't see what characteristics you're using here and here.
I'm not sure this has anything to do with the Android version. The reason this error typically happens is due to how the Bluetooth low energy operates on Android. When you first connect to a device, its services/characteristics are enumerated and cached. This reduces energy uses because production BLE devices typically don't change their services/characteristics so the OS doesn't need to waste time and energy re-querying on every connection. Of course, when you're using a device for development and you want to change something it causes issues.
Two things that I have found that can help in this situation. First, you can try unpairing/removing the device if it's been paired, via the Bluetooth settings in the Settings app, and then reconnecting. Another option is to use an app like nRF Connect to refresh the connection. Android provides some private APIs to do this and while I have considered adding this as a "feature" to the BLE extension I'm a bit loathe to make use of an API Google probably should have made public 6 years ago to help address this scenario.
Great, EW Patton, you're saving my week!
The explanation is also understandable. Respect for your experience with the Androids and thank you above all that you answer here promptly, you are interested in the problems of others.
So, explicitly, deleting ESP32 from the Bluetooth list and registering again does the trick.
It's good to know the behaviour of the different Android versions. Is there a way for the app inventor to query the respective Android version?
It would then be possible to query e.g. MS Explorer versions in a similar way to HTML pages and provide alternative code accordingly. - In the case of Android 13, perhaps a note would suffice: "Please log off the Bluetooth device again and log on again if difficulties arise".