AI2 companion for my apps stops suddenly without any error message

Hi.., can someone help me? I'm using this app to display data from my sensor board. What's happening to my app? It closes suddenly and there's no error message at all. Please this is urgent for my task

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

export_and_upload_aia

.

While you're at it, you might as well also upload the sensor board code, to see if it is poisoning the app with bad data.

Use logcat to find out what is going on

Taifun

Hi this is my aia file for my apps, i used ai companion to run my apps
Alicia_TinyML_DataLogger_ext.aia (403.9 KB)

and this is the output of my code, the number value that will be sent to the database and displayed in the application

and this is my code in arduino.ide
XIAO_BLE_ACC_Data_Logger.ino (10.4 KB)

Your BLE extension is a few years old.
image

The outer if/then on each of these makes no sense, comparing incoming serviceUUID against itself.
You would think you would want to compare the incoming serviceUUID against one of the three global UUIDs you have.




2 Likes

I've updated for my ble extension to newest version. but the problem remains the same, AI Companion suddenly disconnects when it starts reading data

...and those serviceUUID checks?

1 Like

Aside from getting those serviceUUID checks right, you have the problem that your submissions of Google Form updates are being driven rapidly by the incoming BLE data stream, with no regard for whether or not the Google Form requests finished.

When data comes in faster than you can write it out, you need a place where it can pile up before being sent out, typically a list, fed at one end and depleted at the other, with monitoring of the length of list on your display to warn you of pile ups.

You may have to switch from that Google Form to the Spreadsheet component to do your updates. That component has feedback events for updates.

1 Like

I recommend doing nothing but notifications in your error catching events.

You don't want to cascade more errors in an error catching block.


1 Like

OMG why am I so careless :frowning: it's already working. Super thanks to you!
do I need to add a higher delay in my code?

Time will tell.

so i need to delete that 3 blocks? it will not affect the data reading function?

Given that your app is working now, deleting those blocks would be premature.
The deletion recommendation was in case you had an error cascade, which has been disproven.

1 Like

You shouldn't really use the Companion when testing BLE. Compile an APK and install it. However, first of all fix all of your unconnected Blocks (see the 'Show Warnings' bottom left of Blocks work area) and fix your ErrorOccurred Block to:

  1. Report all values and
  2. Set the values in a Label that you can Screenshot:

Bear in mind that Screen1 is the 'King' of the Screens.

Screen HOME: Button Start will create an additional Screen1 !

Just do this:
Snap1

Similar issue in the History Screen.

I note that you have no BLE permissions requested. What version of Android is the App on? What is the Bluetooth version number of your Smartphone? What is the Make and Model of your microcontroller? Seeed XIAO ??????

Has this file been compressed? I cannot load it to study the code.

okay i'll remember it. thank you :smile: :clap:

ahh i see, i build screen1 first coz that's the point to monitor data. but when I open the app, I want to make ScreenHOME the first thing that appears

That's perfectly fine - just make sure you transition between Screens properly.

EDIT: You could of course make Screen1 the home screen and that would be better. Build a new Project by copy-paste from the current project.

1 Like

Hi, I'm back sorry. I can't delete the data in the database as I want. Do I have to pay for the Google Sheets API service? I want to delete all data when clicking "reset"