The CallBackgroundProcedure is only meant to be called from the user interface (non background), it wont have any effect if you do so from background.
Yes! The naming convention ui_ just tells Itoo that the procedure must be executed on the user interface. (Note: if the application isnt active, the procedure wont get executed). You can also normally use the ui_ procedure.
It will be true since now you are in the background.
Now it will return false, since the flow is not in the background anymore.
It is the same as when X called ui_Y, it will be false.
Now again the application flow is in background, so it will be true!
Hmm maybe there are such features offered by Android, but with the current version you cannot do it directly.
You can create your own methods, for e.g. you can implement any of these:
Heartbeat timer: Update a value every X second in UI and check the last updated time in the background.
Echo method: Send a message from Background -> UI, and make the UI send back a response to the message. If the background receives response in given time, then it concludes the UI is active / inactive.
You may expect this feature officially added in the upcoming updates.
Thanks for the information... and two great ideas if it is necessary. But as I understand it, making the mistake of calling ui_xxxxxx from itoo background would not do anything (and therefore, not anything bad )
I also intend to use the implicit event registration you have provided in this update - another nice touch!
BTW, may I ask what "itoo" means or represents (a word? an achronym?)
[Edit about 4am GMT Wed]
Came across another question:
How can UI get a function return from a background component. For example, if Player1 is running in a bg itoo service, how can the UI determine the value of Player1.Is_Playing or Player1.Source?
Any method other than the above "echo method" in reverse?: UI procedure X calls bg procedure Y that makes the inquiry (Player1.IsPlaying) and sets an itoo variable which is monitored (loop or alarm) by the UI X for an updated value....?
Calling ui_x does something, it calls the procedure from the UI. (If the UI is active)
Yeah I didnt include it in the first post to not confuse new users
It is just a random name I come up with sometimes, I guess its cool to pronounce "Itoo" (o in Itoo is pronounced as English letter O itself)
You are right, there is no direct way to do it exactly, I just got an idea to take the extension two steps further in future. For now you need to either "ask" the background service to provide that information in some way using the existing communication tools (procedure calls, itoo's store/fetch) etc.
I would say In the coming months, the future of creating background tasks, is gonna be more revolutionary. It could also be possible in theory to "directly interact" with background components from UI
To solve a similar problem, a few months ago I was working on bidirectional streaming communication system. That would provide seamless communication b/w the background and the UI. Couldnt do a lot of work back then.
I'm not aware of anymore other non-similar methods, but the future of development of this extension is going to be aimed towards solving those kinds of issue.
I found a problem with the latest Itoo extension 4.4. Took me a lot of time to figure out what the problem was. My phone is Android 14 Xiaomi Redmi note 12 Pro.
The problem is that if you use 2 screens, let's say the 1st screen is a welcome screen and use Itoo extension in the 2nd screen, then you have to add Itoo extension in the 1st screen also (photo) else the Itoo process won't start in the 2nd screen !
Thanks for the discussion/answers - it helps....and the future of itoo looks bright!
Why do I keep thinking of "just one more question" :-?)
Ok - last one, I promise (until I think of another )
Once the Itoo.StoreProperty is used, when does the itoo data space get cleared. When it is stopped using Itoo.StopProcess? How about when it is forced to terminate using "Force Stop" in settings? Would it ever be necessary to uninstall in order to clear the data space?
Hi, I need help with programming in MIT App. I am using the Itoo and UrsPahoMqttClient extensions. I need to create a notification when an MQTT message is received. If I close the app (not just send it to the background), the notification stops working. I tried using a timer or something similar, and it works the same way. Is this even possible? Can someone explain this to me? Is it because of TinyDB?
Yes, do NOT use TinyDB, alternatively you should use Itoo's own Fetch/Store blocks
Secondly, in the pozadhi procedure, you are not touching any block of MqttClient so therefore, that component will not get created at all!
Just add the above block at the start of pozadhi
Thirdly, you are registering the events wrong! Anyways, if you are on the latest version of extension, you can use automatic events feature (you wouldnt need to use the RegisterEvent block) Just do this:
In this procedure, you will handle the message received event.
Fourthly, you CANNOT interact with UI blocks from the background. That means you wont be able to change any Label's text, any such attempts may crash the app.
You cannot use Global variables in background.
Reading the first post, about design and guidelines will help you.
Well I guess that would be the primero example of "persistent" data ...
BTW, on this app I am using a home spun method of keeping up with what's in the itoo data. I have wrapped itoo.StoreProperty with a procedure which first fetches a list variable, propertyList, from itoo (empty one if not there), checks to see if the variable being stored exists, and if not, it then adds it to the list (which is also stored in itoo). So that I can dump the content of the itoo memory variables at any time for debugging or whatever. Not sure it will be worth the trouble, but I am trying it. [this reminds me I must disallow the name of the list as a variable to be stored - oops ]