Open Source • Background Tasks: Itoo 🚀

You do something with BLE... I can't help you with that, I do mot have your devices

If you want to work with itoo, you should already have some experience... get your app working in the foreground first...

then try simple tasks in the background, follow the guidelines in the first post... and follow the advice you already received

Taifun

Aaah, so Register eventName should be taken from block addresses, not made up by myself =) I'm starting to get it. Thanks

ok. i will send the code in parts

That's not what I mean, I do not have all the time to go through your blocks. If you require help, you need to make it very easy for me to help you. Like reducing the number of blocks. Also make sure you have completely read the first post.

Itoo Sky 4.4.0

  • Ability — Call background procedures from UI
    Once a background service is started, you can call a procedure to run in background.


  • Ability — Call UI procedures from background.
    Now you can call to update user interface while in background, if your app is open :wink:
    Wait, what are the requirements?

    Carefully notice the above blocks.
    We are registering the Timer event of Clock1 and we keep track of the counts and increment it by 1 each time the Clock1_Timer is called.
    Then we call the procedure ui_update from the background that will update the count in the label.
    So whenever you need to call a procedure to user interface, the procedure name must start with prefix ui_.

  • Ability — Automatic event resolution system
    Beginning from this update, you do not necessarily need to register for events using the RegisterEvent block. From now, Itoo will try to search for a procedure using the naming convention ComponentName_EventName and call the procedure if it exists.

    image

    Demonstrating automatic event registration for Timer event of Clock1.

  • Behavior — Now when you click the notification, by default it opens the application. (Screen1)

V4.4.0 xyz.kumaraswamy.itoo.aix (91.1 KB)

Donate

Maintaining and updating extensions is a tedious task, I'm an high school student, if this extension has been helpful to you, then please consider donating to keep me motivated.

Paypal — paypal.me/XomaDev

Kumaraswamy B G
Thank you

5 Likes

Great update!

Concerning the example

Wouldn't it be possible to call Player1.Stop directly from the user interface to stop the music?

Taifun

Hi Taifun, we cannot directly call Player1.Stop from the user interface. We first have to route the call through a background (environment) procedure and then call Player1.Stop.

This is because there are two environments.

  1. Background environment (managed by Itoo) which provides background execution.
  2. Normal App Inventor environment.

Both of the environments run isolated from each other.

So, when we call Player1.Stop from the user interface, we here are accessing the Player component that is managed by the default environment.

But if we were to route this call through a background procedure, now we are accessing the Player component managed by Itoo.

So it looks like we only have one Player1 that exists. But this isnt true. There are two versions of Player1, one that exists in the normal environment and one that exists in the Itoo environment (background process).

1 Like

Hi I'm trying to display a notification while the app is in the background and when I click the notification it will open the app. The counting (calling the notification) doesn't seem to work. Any ideas?
Preferably I would like the user to click action buttons but let's just take it the simple way.


testNotification(1).aia (126.3 KB)

Refer to Notification Style extension docs for that:

Generally fill all sockets

Screenshot_20240928_034537_DuckDuckGo

Taifun

Yes I found that. Fixed also the variable needed for the Itoo procedure (always forget that) but still it's not working.
I don't even see the "Starting" notification

It is your procedure Notification, which requires the x, not your ClockTimer procedure

EDIT: also remove the method from procedure Notification... it will not work like that, because post notification permission still has not been granted there

Taifun

ok I just saw you edit. I misplaced the X variable

i have the tested "shake and send sms "project in mit app .
i need it to convert it to background task with some fee.shall i send .aia and .apk files so that u can quote.

See again my answer from here

Taifun

Great update! thank you

1 Like

Hi
I'm trying to add a button to the Notification example above and it doesn't work. I can't see the notification at all. If this works I will try to add the button capture in Itoo using the "NotificationButton" procedure.

HI, can you please post your AIA? I'll look at it later.

thanks
testNotification.aia (126.9 KB)

1 Like

Hi @Kumaraswamy ,

Did you have time to look at it ?