Version 4.0 is launched!
Working with procedures
A guide that explains the use of procedures for downloading a photo from the internet in the foreground mode.
version 4.0
We create a procedure that will download a photo from the argument.
Currently, if the app closes, events won’t work except for others.
In the event Initialized, we have set the property “Procedures” so that the extension can keep track of the procedures even when the app goes off.
Now we have to create tasks and start them.
We create a component named #Fun
here.
It is an inbuilt component.
Then we create a function with a block
named “Invoke”.
It is a function that will call our download procedure.
For the values, we have to give it two inputs, the first one will be the procedure name we are calling and the second element are the args in a form of a list, in which there is an image URL.
When the Procedure is invoked completely, an event of name “Processed” will be called, then the function with component “self” and block “stop” is invoked that will stop the service itself.
The last step is to start the service, we define latency and properties accordingly. foreground
should be checked to be true for our procedure to work.
Since our program needs internet, we set “requiredNetwork” to “ANY”.
This logic can be applied to all components and inbuilt blocks (maths, texts…).
Foreground mode needs a notification to stay live. To configure the notification accordingly use the ConfigureForeground block.
Downloads
Blocky.aia (466.9 KB)
Make sure to change the Image URL.