Open Source • Background Tasks: Itoo 🚀

??? your code is wrong, bgTimer procedure should NOT have the parameter y.

Ahh, its working now.
Can you explain when to use parameter x/y in procedures while using Itoo, and when not to use?
Also, only vibrating, sound is not played.

If the event that you are using has the n number of parameters, then your registered procedure should have it too. The same number of arguments.

Before you call Player1.Start, you first have to manually set the source/music again. Remember that this is background, so you have to reinitialize properties manually.

You mean to say:
I have one eventname: "clock1.timer" inside procedure: "MyFGprocess"
So, I should have one "x" argument in "MyFGprocess" procedure.
If, I have two events, then I should apply x and y arguments?

No, your main procedure MyFGprocess will always have only one argument x

In your example you register the Clock1.Timer event. That event does not have any arguments, so your event handler bgTimer also will not have any arguments

The event handlers need exactly the same number of arguments as their corresponding events

Taifun

2 posts were merged into an existing topic: [PAID] :alarm_clock: Alarm Manager Extension with Notification or Autostart

I am not able to understand meaning of arguments. Can you elaborate?

Well, there are so many examples available in this thread...

see also what Gemini is responding below
Taifun


In MIT App Inventor, an argument in a procedure is a variable that receives a value when the procedure is called. It acts as a placeholder for data that you want the procedure to use to perform its task.

Key Concepts

  • Parameter vs. Argument: The terms are often used interchangeably, but there's a technical distinction. In App Inventor, the variable defined in the procedure block is a parameter. The value or variable you provide when you call that procedure is the argument.
  • Input for Procedures: Arguments allow you to make a procedure more flexible and reusable. Instead of creating a separate procedure for every slightly different task (e.g., one to calculate the area of a 5x5 square and another for a 6x6 square), you can create a single procedure that accepts the side length as an argument.
  • Scope: The argument variable is local to the procedure. This means it can only be used and its value can only be accessed within the blocks of that specific procedure. It doesn't exist outside of it.

Example
Imagine you want to create a procedure that calculates the area of a rectangle.

  • Without Arguments: You would have to hard-code the length and width inside the procedure.
    This procedure would only ever calculate the area of a 10x20 rectangle. It's not reusable.
  • With Arguments: You create a procedure with two arguments, length and width.
    Now, when you call this procedure, you provide the actual length and width values.
    When you call the procedure and provide the values 5 and 8, the length argument receives the value 5 and the width argument receives the value 8, and the procedure then calculates 5 \times 8 = 40.
    This single procedure can now calculate the area for any rectangle you specify, making your code more efficient and organized.


I have understood the explanation.
Getting back to original code above:
bgTimer does not have any parameters, so no arguments.
But MyFGprocess also does not have any parameters, then why x argument there ??

Also, in the image provided by you, process "run" does not have any parameters, then why x argument there?

From the Usage documentation in the first post here

This is a requirement for iToo to work correctly.

Also to play a sound, see again the already given advice

Taifun

Screenshot 2025-09-16 223826
So, while I was making an app designed to detect movement and then send a notification to the phone, I realized that the code did not happen more than once. I wanted to know if it is possible to start the entire code from the movement detection until the notification once again? This is all I did for the looping function and I don't really get how to do it.. if it is possible... Thanks.

How do you loop an entire system using Itoo extension?

Screenshot 2025-09-16 223826
So, while I was making an app designed to detect movement and then send a notification to the phone, I realized that the code did not happen more than once. I wanted to know if it is possible to start the entire code from the movement detection until the notification once again? This is all I did for the looping function and I don't really get how to do it.. if it is possible... Thanks.

Create the process for example in a button click event. . The name of the procedure should be loopingfunc

Then do what you want to do regularly in the event handler called loop

How do you do this?

Taifun

So, the idea is for the detector to detect movement while the app is closed until the user decides to stop it, so I was hoping for it to continue performing its processes everytime it detects movement. However, when I tested it, it tests for movement once, does all its procedures once, and doesn't do it again. For reference it starts from here:
Screenshot 2025-09-17 071927
After it senses shaking, it does this:


Which in short, just tests for movement every 500ms until it hits 5 times in which it will then activate the next procedure:

This builds and sends the notification and it is here where I try to implement the loop. So, I do want to try the button thing you said.. but wouldn't that only loop it when the button is pressed? I did try it but I still don't know what I'm doing... this notification has extra buttons which send a message when pressed btw. Don't know if thats needed but yeah.

Hi,

I'm trying to save a list in Itoo but it doesn't seem to show anything in the list. Any ideas ?

You are currently saving an empty list in your code.first fill a list,then save it

1 Like

@SlowBro There is a lot of confusion in your blocks, it looks like you are putting blocks together without understanding what you are doing

Have you seem my shake it example? Run app in background, that fires an alarm whenever phone is shaking - #4 by Taifun

Use that example and restart from there
You create the process only once on button click

It starts the background process... somehow the process must start...and after starting the process then the sensor is activated to listen in the background

Taifun

@Jimis your blocks are mostly ok, you are adding item "1" to the list, you only forgot to store the new list via StoreProperty method again, so later you see the difference after button click in the user interface... don't forget to open the listview there

Also there is no user interface in the background
EDIT: what you are doing is no real background processing, you are only creating the process, so this is not really a test if something is working in the background or not...

Taifun

Thanks !