BT works with AICompanion, but not as APK on Samsung Galaxy Note 10+

Hi all,

TYhis APP comunicated with an ESP-32 to get data. I works well when using AICompanion, but when I create an APK, it does not complete the search-for-BT-function.

Hope it is a simple fix ....

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




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.

By @ABG
Taifun

Thank you, much appreciated.

Cheers, Charles

As always ... change something and something else breaks ....

After including the blocks you suggested, it now crashes the AICompanion app after the first attempt to comunicate with the esp-32 .... from my ESP debugging Serial.println statements I can see the ESP receives the character from the AICompanion, and sends the expected response, but that is where it crashes. After a while, the cell-phone tells me the app has become unresponsive and then disconnects.

Here is the block which sends 'c' to the ESP-32, and expects a reply

OK, looks like I dont know how to post a simple block here .... sorry

Image is not Code so don't format it as Code...

Why aren't you receiving from your Clock Timer event?

OK, so I think I am making a bit of progress ... I loaded a previous version of my app, and it works. The main difference I found is the naming of the non-visible component, BluetoothClient1 in the current version which crashes, versus BluetoothClient_1 in the older version of my app. - How can i change it back ? I did notice that all refrences to BluetoothClient_1 had to be changed, but didn't think much of it then.

@ABG , I am not sure what you're referring to here

@Patryk_F , how does one insert a block into this ?

This is the typical Ai2 BlueTooth polling code:

Here is a simple BlueTooth text receiver sample, for single value per line:
blocks
initialize global message to