Yes, you can do that, use CreateProcess. This requires to show a persistent notification, which can be dismissed through a simple swipe (starting from Android14).
I would like to better understand what this means especially as regards accessing the same named clock component from both UI and by the service started by itoo1.CreateProcess, specifying procedure for example as "PlayerService". I hope answers to these questions will help.
If I have a clock named clkWallClockTime is it proper to reference it both from the UI or the itoo service by the following?
If I have a clock named clkDelayStart which is referenced in PlayerService by:
clkDelayStart.Timer_Interval = 1000,
...then can I enable that timer from Screen1.Initialize by:
clkDelayStart.Timer_Enabled = false?
[Edited 0514 GMT, 8 May, 2025]
If I define the event processing in the clkDelayStart.Timer event from the UI AND in the itoo service using itoo1.RegisterEvent (clkDelayStart_Timer) from PlayerService with procedure such as "eventProcessing"...then when the timer fires, which will be executed: the UI defined event processing or procedure "eventProcessing" registered by PlayerService or both?
[Edited 0514 GMT, 8 May, 2025]
I hope these make sense, even though I know I am asking them out of my confusion
This means before creating an event handler for a component do something with that component
For example for a clock set the time interval
Alternatively just add an evaluate but ignore block together with the clock in your CreateProcess procedure
Yes you can
You could take the the current time from any clock, no separate clock necessary
First set the time interval and to enable the clock set TimerEnabled to true
The UI event will get triggered only if the app is in the foreground
Only one event will get processed depending on the app being in the foreground or background
I'm not sure, if both will be executed in the foreground... better to test this or wait for an answer from @Kumaraswamy
EDIT: see my test below Open Source • Background Tasks: Itoo 🚀 - #1041 by Taifun
I do not want to make CallBackgroundProcedure or ui_wrapper calls unnecessarily to call between UI and itoo service, if I can just reference the one Clock from both.
The general question is "can I set/get properties from a single Clock both from the UI and the itoo service (so long as I reference the Clock in the CreateProcess procedure)?"
I do not think this is something I would ever want to depend on, but it would help (at least help my understandind ) to know. I can imagine that if the UI is in the foreground/active when the timer fires that there may be no way to predict which "event" is ahead in some queue. So @Kumaraswamy, if there is no answer , I understand.
Does the same apply (direct access of a single component from UI and itoo service) for a Player component as it does for a Clock?
For some reason I have been under the impression that when a Player is referenced within the itoo CreateProcess procedure, that a distinct and different Player is "instantiated" - one which is separate and independent of the one which exists in the UI - which can must (and may only) be accessed from the itoo service.
So that, in order to interface with a single Player from both UI and the itoo service, one must call a ui_ prefixed procedure from the itoo service or call an itoo CallBackgroundProcedure from the UI (or use a messaging mechanism) in order to control a single Player, which exists only in either the UI or in the itoo service.
Is this correct? Or, for example, can a single UI Player component be referenced directly from the itoo service as well as being referenced from the UI (the way a Clock component can)?
There is a Clock1 running in the foreground and a Clock1 running in the background running independently from each other
The counter in the foreground works only if the app is in the foreground. Timer interval is 5 seconds. After closing the app it starts from 0 again.
The counter in the background starts after clicking Start button. It increments each 2 seconds being the app in the foreground or in the background. In case the app is in the foreground, the current background counter value will be displayed in a label.
Indeed - two instances of Clock1, one in the UI space and the other in the itoo (background) service space.
Just to confirm the complete separation of the two clocks "address" space, I added reading and displaying the interval and enabled properties before they were set in both spaces.
What I found for the Itoo Clock1 was surprising. Before procedure "run" set the properties, they were not according to the initial values given in the "Designer" view which were 1500 msec and false, but were 1000 msecs and true.
Not a real problem, since initializing them in run is sensible and probably good practice, not counting on any design initial values. But it was surprising.
As far as the question about Player components, I realized that the app discussed in post #808 demonstrates the independence of Player components with the same name in both UI and Itoo service environments.
can anyone help please i don't know what's wrong but it does not work for me.
i get the itoo notification that the process is working on the background but i don't get any notification from Melon, when i click Button2 the notification appear. but with itoo not working when the app killed