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

That's a wild guess and I do not think so
You can easily create a test project and add some debug statements to proof, that this is not the case

Can you elaborate? Probably your background process sometimes does not continue after waiting 30min ot 1 hour and the Android operating system is terminating your process?

If you want do do something regularly after a given time (in your case after 30min/1h) usually you use the alarmmanager functionality. My alarmmanager extension is able to do some processing after a given time in the background App Inventor Extensions: Alarm Manager | Pura Vida Apps

Taifun

1 Like

Thanks, You mean than your extesion will be used in Itoo?

No, it's the other way around, my extension will use itoo functionality, Itoo X Framework: Virtual App Inventor environment for Background execution - #2 by Kumaraswamy

Taifun

when i do this, nothing happens, the device does not get connected because im guessing itoo processes cant read the listview1.selectionindex and act upon it. i also added a evaluate but no result of listview1 but still nothing happens.

  • the list view shows both the address and devices name so i cant use listview1.selection and store it via storeproperty block

No? Why not? Don't you think it would probably be a good idea to share your updated blocks?

Taifun

I did a search for you in the itoo thread and found the following BLE example for you

And another example

Don't hesitate to search yourself, too...

Taifun

yeah sorry i was about to, so


i removed all the timers in order to narrow things down.
and when i run this, nothing really happens, the device does not show signs of connecting at all.

well as the listview contains both- the address and the name, i cannot use connectmatchingname or the connectwithaddress block, i would probably need to create a way to save both to utilise them into the itoo procedure blocks.

also, when i directly hardcode it to my devices name using connectmatchingname, this still pops up
17f1178ee267d0707b756ddd313f6b7e0f4daca9_2_690x339

the one below this one is completely hardcoded and what i wanna do is use the listview for connecting the device.

UPDATE:

for this, i got the address from the listview and saved it using storeproperty block

.
but the error 3300 still persists and i dont understand why.
(The device still vibrates for 0.5s as thats what i allowed it to do in bytesreceived blocks so that means that the device IS connected)

First store the address, then connect

Taifun

thank you for your help so far, this fixed the error issue entirely. i am facing a new problem instead of that tho


everything works fine when the set charuuid.text to block is disabled, but when i enable it in order to get the characteristic uuid, i get a runtime error, why so?

and how do i fix this?(the whole itoo process stops working altogether when i enable that speicifc block.

Probably it is a background/foreground thing? This is only a guess...

You are calling GetCharacteristicsForService in the foreground while all ble functionality is in the background

Try to call it in the background, store the result using StoreProperty and then call ui_bleconnect
In ui_bleconnect then use ReadProperty and display it in label charuuid

Alternatively use logcat for debugging without using ui_ procedures

Taifun

Itoo background extension is no more working. Itoo 4.4.2 sky
I have given days and days to learn it. Even used chatgpt to learn. But with no success.
Then I tried step by step assuming some errors in itoo. And I was correct. Errors in Itoo coding, it does not work. I read documentation and tried sample projects given "Doing get request every 5 seconds."
Not working. Clock.Timer does not work.
Even this simple code doesnot work after installing apk.

??? 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?