[Discontinued] Background Tasks [4.1] 🥳

Change the value of the function name to “Initialize” and not “initialize”. Make the first letter capital and try again.

1 Like

Xoma good to see you back love the work im on a samsung s7 running android 8
i have the create on ui. and the resolve in the start screen

every thing works fine til i swipe the app away (firebase DataChanged)

i can hit a button to run the blocks it wall pick up on any change the URL is set to
but when the app is closed no more responce no data pulled

when i reopen the app i do not need to hit the button and the firebase DataChanged ) works with out any interaction and can stop and start.

anything new in the mix that could help me here. love the work happy to flick you some crypto (bitcoin) if you can help me or not you are the only one whos attempted this kinda work for these block builders

our futures are in your hands. =) lolol jokes aside really appreciate your work

in next reply attached a btc adress and i put some btc thu for you =)

2 Likes

Hi Van, thanks!

In theory, if it works when the App is opened, it should also work when it’s closed.
Some OEM devices put restrictions on background services causing them to not work properly.

If there is something like the phone’s battery optimization On, turn that off and check for background restrictions put by the device.

See here, how it varies by device:


I don’t have a BTC account now, I have PayPal:

1 Like

I am now working on a thing that makes calling procedures possible from a background (foreground) service :partying_face:

Did a few tests yesterday, got them working :blush:

4 Likes

Do upload it on github also please. :+1:

1 Like

Almost done :partying_face:

Some beta testing and few more tests remaining :grin:

1 Like

You can count with me to help with the tests. Just send me the aix and tell me what you want me to do and I will be glad to help

1 Like

Version 4.0 is launched! :partying_face:

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



download_photo

We create a procedure that will download a photo from the argument.
Currently, if the app closes, events won’t work except for others.


Initialize

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.

CreateComponent

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.


Start

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.

10 Likes

#Fun - where from???
how to use it

@Xoma, show a simple example plz

1 Like

You just have to type that, its an inbuilt component in extension. :wink:

1 Like

@Xoma: “set Tasks1 procedures” - need to use for EACH procedure?

No, you have to give it a list of names.

1 Like

@Xoma, where do these elements come from in “CreateFunction”???:
“end task”
“self”
“exit”

maybe example from standard components from Kodular?

Those are inbuilt. You don’t have to do anything.

1 Like

to be honest, I didn’t understand at all where the “self” component and the “exit” block came from (((

we don 't understand your thoughts ) We need simple examples.

What do you mean? Just they are inbuilt, pre created things (in a simple way). You just mention and use them.

1 Like

ok.
math function?
How use the #Fun component for “math” operation?

Please understand how it works before asking it. You apply the same logic of the procedure.

in examle “Blocky” where is the creation “end task-self-exit”?