Apps using Itoo and build after august 17 cause the app to crash

Hello,

in the test-app "Sensoren_Accel_Steps.aia" I only use
image.
Which of them is a paid extension? I I just bought "AlarmManager".

Greetings

Hello Kumaraswamy,
I upgraded my app using Itoo Sky v4.3 build 2024-8-24.
Unfortunately this version of Itoo is only partly working for me.

Please take a look at my app.

PhneBuddyV2_0.aia (289.9 KB)

When the "Start Monitoring" button is pressed, the "startMon" eventhandler starts the Itoo foreground service "keepBleAlive". This works fine.
In addition, the broadcast "startReceived" is sent. When the broadcast is received, the Itoo foreground service should call the "startBle" procedure to start BLE advertising.
As far as I can see, the procedure "startBle" is not called and BLE is not started from here!

(Please note:
The Itoo foreground service "keepBleAlive" also starts a timer Clock1.Timer which fires every 5 secs. The Clock1 timer eventhandler "handleTimer1" checks if BLE is running. If not running (but should be), it starts BLE after all.
So, if BLE is not started by pressing the "Start Monitoring" button, it is started by the Clock1.Timer eventhandler a little later. However, by design, it should have been started by the pressing the "Start Monitoring" button.)

When the "Stop Monitoring" button is pressed, the "stopMon" eventhandler sends the broadcast "stopReceived". When received, the Itoo foreground service should call the "stopBle" procedure to stop BLE advertising. As far as I can see, the procedure "stopBle" is not called and BLE is not stopped!
In addition the "stopMon" eventhandler starts a timer "stopClock.Timer" that stops the Itoo foreground service after 30 seconds. This works fine (but BLE is still running!)

What is working:

  • start and stop of Itoo foreground service
  • use of Itoo properties
  • Itoo Clock/timer eventhandling

What is not working

  • Itoo broadcasting functionality

What I tried:
By default Itoo uses the "DataSync" foregroundservictype
I also tried "ConnectedDevice" and "SpefialUse" foregroundservicetypes.
In both cases the app crashes as soon as the Itoo forground service is started.

I might be able to workaround this issue, but I think it is important to fix it in Itoo.
Many thanks in advance!

These are the extension in your aia. You have version 9 of Taifuns Alarmmanager extension on it.

image

Hello Kumaraswamy,,

after the update of the AlarmManager my Main-App is now working too.

The compagnion isn't working also with apps without Itoo. I tried all suggestions given by MIT, no success????

As i don't now, if you save my Test-App before Taifon removed it (Sorry again to Taifun for this mistake), here is the new one without the AlarmManager-Extension.
I tested it on Android 9 and 14, again the Acceleration-Sensor didn't work in background, Pedometer is OK.

For your help in advance thank you and best regards.
SensorenTest_Accel_Steps.aia (93.3 KB)

Itoo cannot work in the companion app.


I looked at your project, I see that AccelerometerSensor1.AccelerationChanged --> changing which is right but then it calls Show_Accel which attempts to set label text.

This is not possible, you cannot change UI elements when your blocks are called from background. That's why it crashes.

Hi Marcel, I checked your project, you are doing almost everything right except the fact that procedures startBle and stopBle are missing an argument "x" which is meant for the message slot.

startBle() -> startBle(x)
stopBle() -> stopBle(x)

Since you are missing an argument signature, this Itoo fails to call your procedure.

Hi Kumaraswamy,

I added the argument to startBle and stopBle as shown

Doesnt make any difference. Both procedures are not called..

I see you are using the BLE extension. Do you have the latest version?

Hi Peter,
No Im not using the latest BLE extension because of this issue:
Create and send BLE advertisements

Im using the version provided by Ewpatton, which works.

However, the problem is not the BLE version Im using. The problem is that Itoo does not call the procedures startBle and stopBle which should start respectively stop BLE.

Hello,

thanks for your answer,

The problem with the compagnion is not that Itoo cannot work in this App, the problem is, that in Android 14, after the connection is made
image
, the mainscreen of the compagnion is frozen!
image
I tried Version 2.72 and Version 2.72u with Apps with and without Itoo. It works OK befor the last Update of Android 14.

What i also don't understand is, why the same routine with "set label text" in "STEPS" works an not in "ACCEL"?

Greetings

It is not Itoo's fault. All the procedures are called properly. I discovered this error message while I was debugging your program:

AEvent(ErrorOccurred=null) args [edu.mit.appinventor.ble.BluetoothLE@49fba75, StartAdvertising, 3300, Error 9121 in extension BluetoothLE: More than 31 bytes in advertising packet] listener = xyz.kumaraswamy.itoo.Itoo$1@4329dac

Hallo Marcel,

as you can see, i do not use the bluetooth extension, so why this error?

Greetings

Hi Kumaraswamy,

I dont think it has anything to do with BLE.

I stripped all BLE and all other non relevant stuff from my app. What is left is basically property and broadcast handling.

"startBle" and "stopBle" now only update the property "state". The "state" is updated on the screen when "Timer" fires (every second). However when pressing "Start Monitoring" or "Stop Monitoring" the screen is not updated..so "state" is not updated...so it looks like "startBle" and "stopBle" are not called. Could you please further investigate? Many thanks in advance!

PhneBuddyV2_0_noBle.aia (287.4 KB)

Your blocks do not really nake sense
If the app is running in the background, there is no user interface available to display anything
Also how exactly shout these procedures startBle or stopBle be called and by whom?

For a working ble example in the background see here.

Taifun

It is something to do with BLE. It errors out in background. Thus making the background operations problematic. Please refer the error I posted.

Edit: I need some time to investigate your new AIA.

Hi Taifun,
Let me explain.

The UI of the app enables the starting and stopping of BLE advertising running in the background using Itoo. The state "started" or "stopped" is displayed whenever the app is openened. So I will always know what the state is by opening the app. That makes sense doesnt it?

I carries a wearable device with me that just scan for the BLE advertisments. When found everything is ok! When not found, my phone is out of range and the wearable device gives an alarm. I use the rssi value to set the range/sensibility between my phone and wearable device.

This app worked without any problems up to 17th of August. Since that date new builds didnt work anymore. The problem was recognized and Kumaraswamy provided a new version of Itoo.

This new version introduced a new issue for me. As far I was able to do problem determination, it looks like the broadcast fucntionality doesnt work anymore. At least not for me using a Samsung A52 running Android 14.

In the PhneBuddyV2_0_noBle.aia posted above, I stripped all functionality except for the Itoo broadcast handling. Indeed the app doesnt tmake sense anymore, but I hope it would help you to find out what is going on.

Please give it a try and let me know the results!

Many thx in advance!

The broadcast functionality is working on Android 13. It seems to be an issue on Android 14. Im researching more.

Edit: I currently lack an Android 14 device. Im unable to test this :frowning:

Hi Kumaraswamy,
Let me know if I can be of any help. Collecting logs perhaps? I have ADB running and USB debugging enabled, but might need some guidance from you how to capture the right data.

What about providing a working example app as small as possible then?

Also

Taifun