Background Tasks extension [3.8 A] 🥳

Currently it's not posible. Will be added in the next update.

ok. Thanks

1 Like

Extension 3.1 A

:smiley: The new version is ready and includes the below changes:

  • Extension is now more likely to work with components like Notification style and other things :grin:.

    It was my mistake actually.. When the Notification style extension has called (.getClassName) while preparing for the start value for the notification, it would be null and it could not function.

  • Added support towards comparing objects/boolean values (true/false) and others like a string when any registered event is raised.

    Here is the usage of the new component ExtraFunction. It's the same as a function that will compare the texts and if the result is true it will call another function. It basically filters values.

    Wherever you will use {$0} in the Extra function block that means the event values, its the same as the function block which replaces data.

    For the function to know (differentiate) if the function Id is extra functions or the normal functions, you'll need to add the dollar symbol before that.

    To compare strings you should use "anotherstring".equals("comparingstring") or the equals segment. To compare numbers or true or false values you will have to use the = symbol twice like ({$0} == 7). Suppose the {$0} is the event value which means 7 the extension will replace and will compare it like this 7 == 7 and the condition is true so it'll execute the function.

    After the comparison, put a space and put :: with the function inside the function Id, then it'll call the function, below is an example of how it works.

0 event value: "77" (this is string and NOT number)
functionId: "show-notification"


"{$0}".equals("77") :: function(show-notification)
"77".equals("77") :: function(show-notification)
true :: function(show-notification)

(now the result is true so it will call the function id 'show-notification')

Hello, now you can compare objects :smiley:

Great. You are the best. Now i can call function when its "true" how can i add else? so when its false it would call a different function.
Thanks

1 Like

Hello, you can provide two elements to it, so you can prepare different If else statements.

You can add ! exlamation mark at starting at the condition like:

!"{$0}".equals("something")
or
{$0}".equals("something") == false

then it will only execute if the condition is false.

I mean when its true true :: function(show-notification) else function(show-notification2)
so if the statement false i want to call a different function.
Thanks

2 Likes

It's like this.

1 Like

got you. thanks a lot man. can you dm me your ppal i'd like to donate?

2 Likes

Thank you very much!
:smiley:

1 Like

But it will not work if you close the app

1 Like

I think this version of Background Task Extensions is released by @Kumaraswamy
In Kodular Community.

2 Likes

How do we use this? Is there any comprehensive documentation?
Do we put these inside of other blocks in our app, or only standalone?
In the .CreateFunction block, what in the world is the difference between 'ID', 'Name', and 'Function Name'? Also, What are the 'Values'?

If I have a Clock already going, Does this use it? Do I need to create a new clock within one of these blocks somewhere?
I can't wait to get started! I just need literature!

ID in the function just to call the created function using CallFunction block. In the background, the extension will prepare things but it's not directly.

Name refers to the created component's ID here. FunctionName is the block/function name that you want to call.

Values are like extra inputs. If you don't have any input, you can just provide it with an empty list.

Here, the right side blocks are to create a component and connect to a BLE device.

I am thinking to simplify the names... But this may also brake projects.

1 Like

Background Tasks 3.2 A

As time passes... The extension gets better and better :smiley:
So here is another update for it!

There is a total of 3 new blocks, 3 bug fixes and 3 changes!

(Click on the image to expand it.)



  • New blocks

    30.06.2021_22.13.39_REC

    • Clears the task list (the functions/create components) or resets them.

    Pending-tasks

    • Returns the list of currently running or pending service IDs list.

    30.06.2021_22.16.46_REC

    • When the service is killed, this property block will be to indicate if the service needs to start again. The restart time depends on the System.


  • Fixed issues

    • Fixed an issue where if you had entered any function that has Caps in it, the function would be failed to call.

    • Fixed an issue where the service would stop after some time after the app's screen goes off.

    • Now the service will run/start even if the phone is booted or restarted.



  • Internal/Blocks changes

    • Finish task block updated with the boolean value to indicate if the service should start again.

      Finish-task

    • A new way to call functions and return their invoke or the return values directly. This can be used through the MakeExtra block as (invoke:[FUNCTION_ID])

      30.06.2021_22.19.42_REC

    • Now the extension does a quick validation of tasks to prevent empty tasks from being sent to the service.



Download the new version (3.2 A) com.kumaraswamy.tasks.aix (455.2 KB)

If you find anything wrong, please let me know :smiley:

2 Likes

The new repository for the extension’s sources are here :partying_face:

The extension is created with Rush by Shreyash!

2 Likes

Please help me to create an example code. when the phone battery reaches 20% or below, activate an alarm/ play sound. it should work in the background, and also the phone screen is off.

1 Like

What have you tried so far?

4 Likes

2 Likes

No,
We mean, what have you tried through the extension?
Through the extension blocks?

1 Like