Open Source β€’ Background Tasks: Itoo πŸš€

Thank you @Kumaraswamy! I have made this quick test project to convey what I am observing with the broadcast blocks. When the broadcast block gets called from the UI (i.e. button press), it runs as I would expect - I get a notification saying it was triggered by a button press.

However, there is also a 2 second timer active, that is making the same broadcast every time it ticks. To confirm it's ticking, it sends a separate notification each time it ticks, before making a broadcast. However, I never get the notification from the registered broadcast procedure saying it was kicked off from the timer tick. I have included the sample project below. Is what I am observing the expected behavior? Am I missing something?

Itoov4p1_test.aia (116.1 KB)

Edit: I just tested the same project with Itoo v3, and it works like I expect it to! I am getting the notifications saying it was triggered from the clock tick function. So there is different behavior between v3 and v4.1.

Hello @aeozyalcin, I checked the AIA that you posted, that included Version 1.4 and it worked as it should.

I believe you are misunderstanding the broadcast concept here. You are thinking that whenever the service sends a notification, it will also trigger the testBroadcast_fxn.

But this is wrong, when one broadcast is created from service, only the UI can receive it. Service cannot read it's own message.

If a broadcast is created in service ---> only UI can listen to it
If a broadcast is created by UI --> Only the service can listen to it

They cannot listen to their own broadcasts.

Thanks @Kumaraswamy! 2 follow up questions for you:

  • When I swap Itoo v4.1 for v3 on the test project, I see that test_clk_fxn is able to trigger testBroadcast_fxn. Any ideas why the behavior is different between the versions?
  • Thank you for clarifying that service threads aren't meant to trigger a broadcast that was registered by the service. This is how I was kicking off a procedure asynchronously/on a different thread without holding up my main service thread back in v3. Do you have any recommendations on how I should go about that with v4.1? Maybe createTask?

Thank you again!

Probably it might be a bug that got patched up.


I'm not able to comprehend what your saying. In my perspective, why would you want to broadcast a message to the service itself?

I think you are assuming each time you receive a new message, it will be received on a different thread, this is not the case.

Thank you! I clearly misunderstood broadcasts; I appreciate you explaining. Leaving broadcasts aside, do you have any hints/recommendations on how I can achieve multithreading such that I can have a function run on another thread without blocking the originating thread?

An example of what I am trying to do: I have a timer tick event that Itoo listens for. I want to make sure that the timer tick callback function can finish quickly, so that it's ready for the next clock tick. To achieve this, ideally, I want to spawn off function calls from inside this callback to run on other threads, so I am not holding up the clock tick callback procedure.

Any guidance would be appreciated! Thanks!

I understand what you want to achive :blush:
With the current system in place, this is not possible.

Few months ago, I was experimenting with a Automatic Async extension that lets you easily manage and dynamically spawn many threads, however it was not released.

Alternatively, you can use AsyncProcedure extension written by Ewpatton, that lets you call procedures on a different thread.

1 Like

4 posts were merged into an existing topic: Using activity starter calling this cellphone functions like image

9 posts were split to a new topic: I just need to set up a notification that reminds users everyday(at the same time)

Version 4.2 Sky

  • Prepare extension for upcoming Android 14 support.

xyz.kumaraswamy.itoo.aix (79.5 KB)

4 Likes

is compatible or working in android 14 ?

1 Like

I think yes. See the note :arrow_down:

1 Like

yes
and if you have issues, post a screenshot of your relevant blocks

Taifun

1 Like

Hey, i made an extension with chatgpt that has a singular event that checks the device's time and triggers a notification at a certain time and it seems to be working. How do i integrate this with itoo? Should i use foreground or background?

Usually you would use the alarmmanager of the device to get triggered at the defined time... my alarmmanager extension does exactly that... App Inventor Extensions: Alarm Manager | Pura Vida Apps
That solution is battery friendly and does not need itoo to get triggered...

Other solutions drain the battery, because these have to check regularly, if it is already time to trigger the alarm.... choose your solution wisely...

Taifun

1 Like

i might buy your extension if i fail to build mine that simply has to trigger notification style, but i don't have Paypal available rn, and i would prefer not to pay in cryptocurrency, could you setup something like a Stripe account?

1 Like

Hello, I update itto to the latest 4.2 but the problem continue with android 14 U1TDS34.94-12-7-6 in moto g54 5G,
when I click on Start buton I get a simple error saying my app "keeps crashing"
with itoo 4.0 and 4.1 the app opens and closes immediately

but working fine in android 10 and 11

itoo_TextToSpeach_03.aia (82.7 KB)

TKS in advance

The latsst version currently is 4.3, see also

Taifun

1 Like

With 4.3 the app works ok
TKS !

1 Like

Hi @Kumaraswamy, Thanks a lot for your great work, now I am planning to create an app to check wifi when connected if it asks for login details or not, I have created a background task which is to send notification when wifi is connected to any network when the app is closed and once you click on the notification the app opens, unfortunately it is failing to accomplish the task in the background though it shows that it is working but nothing happens and when I try the same in the UI it works normally when I close and open wifi or toggle it the required notification appears normally, I don't know what is the problem.

TestBackgroundTask.aia (301.1 KB)