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

Using itoo.aix extension i want to convert my working mit app which sends sms with location to background task


here is my code.

@DolpGames_Official
You are missing the x Itoo argument for IO_Ble, please read the first topic entirely.


@Chandrakant_Sanap your code is not at all redable.


I put in an X argument, do I have to access it somehow? I'm really confused. I think I did it like in the post, but when I exit the application, it still disconnects the bluetooth connection

No
Read again the first post in this thread

Also what are these events IOBLE and OnOff_ble? These do not exist...
And you should ask for necessary permissions at the very beginning before trying to connect

Taifun

It is not possible to send sms in the background
To do this, your app needs to be in the foreground

Alternatively use an API to send sms in the background, for example Twilio... SMS API | Twilio

Also to be able to receive location changes in the background, you need background location permission... the locationservice extension is able to do this...

Taifun

I'm giving up, I'm so confused I don't understand anything. I've read the whole tutorial, and I think I'm doing everything right, but as practice shows, nothing works. Isn't β€œeventName” just names to be displayed ?

Components do have events, for example the clock component does have the Clock1.Timer event... so for example if you want to use that event in the background, you register that event and create an event handler for it, which looks like a procedure...

So

Taifun

Kumaraswamy, Taifun tks for your work !

I added Bluetooth Low Energy to the example of Battery Checker with ESP32 Arduino

Not is finished but working very good.

Tks Fabian R.C.

batterychecker_5_BLE_V9_15.aia (357.7 KB)

2 Likes

thank you @Kumaraswamy we will wait for upcoming releases.

1 Like

Braslets_copy2.aia (2.5 MB)

Help please, correct the errors, I just don't understand anymore. Thanks in advance :blush:

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: