An extension to create components, call functions or tasks in the background and when the app is alive with various features!
Extension version --> 3.8 A
Beta testers and helpers
- @rizu @themaayur
@vknow360 @MohamedTamer @WatermelonIce
@Hrichik_Mazumder @newbiedeveloper @Know_About_IT @Pradevel
Documentation
Here is the documentation of all the available blocks. If you have found a mistake then let me know about it.
-
Creating a component
Creates a component. No matter if the app is running in the background or the foreground. All you need to do is to specify the component source name and the name which will be used to invoke functions and do other stuff.
-
Creating a function
Creates a function of the component ID specified. Specify the component ID and the values. To access the invoked result use the 'invoke:result' value to store it in a variable and then access it using the extra value block.
-
Calling a function
Calls the created function using the function ID. Make sure the function of the specified ID is created before using this block.
-
Call a function multiple times
Block to call a function specified number of times with the interval between each call. Make sure the function of the specified ID is created before using this block.
-
Creating a variable
Creates a variable with the specified value and the variable name which you can use it on functions.-
Storing the invoke result
To store the invoke result use the value "invoke:result" from the extra value block. An example:
-
Selecting an index
If you're invoke result is list then you can select index from it using the "invoke:result:[INDEX]" from the extra value. An example:
-
Check if empty
To check if an invoke result is an text and list and to check if the list or text is empty then use "invoke:result:empty" value. An example:
-
Finding the length
To check the length of the invoke result length of text or list use the "invoke:result:length" value. An example:
-
Access the variable
You can access the variable value using the "data:NAME" value. If you want to write something like that then use the extra value block and make the text from code.
-
-
Value from code
Executes the code and returns the result. You can use it to perform actions using Java code, calculate sums and return a value. If the value is null or empty, an empty string or text is returned.
- Converting letter to binary format
-
Making a delay
Does a delay in Milliseconds. You can use this block between functions and tasks. This will not affect the UI of the application.
-
Making value from code or text
This block helps you make value from invoking results, do things. The value from it will be executed at the invoke function.
-
Resolve activity
I strongly recommend using this block. Mostly on Chinese devices which requires additional permission to run tasks in the background.
-
Finish task
This block will report to the Android system that the service and tasks are completed. Gives an advantage by saving the system’s resources. Use true as the parameter if you want to remove the foreground notification.
-
Start the service
Starts the service with the given service ID. The instant is the time which you can from the clock component. The services will be executed one after the other and not at once.
-
Cancel the service
Cancels the service by the given service ID.
-
Registers the event
Registers the event with the function ID and event name The function ID will be called with the event values.
-
Cancel all tasks
Cancels all the pending tasks.
-
Destroy the component
Destroys the component and its registered events.
-
Extra function
The extra function is to compare objects and call the respective function Id. To know more about this click here.
-
Creates component on UI
Creates the component on the UI thread, because someone component like clock should be created on this thread.
-
Restart of kill
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.
-
Reset task list
Clears the task lists and all the functions (Create components, functions, events) and others.
-
Pending tasks IDs
In the format of a list, returns the pending/running tasks IDs
-
Periodic tasks
Periodic tasks will run the service with the given interval with a minimum interval which is 15 minutes (after Android oreo). This functionality cannot be used with latency. Latency should be set to zero.
-
Flags feature
-
Flags are to pass any extra values or to change the behaviour of the service. There are currently three flags.
-
FOREGROUND_IMPORTANT Marks the foreground state of the service as important using the internal API.
-
IGNORE_FIRST_PERIODIC_RUN Ignores the first periodic run which gets immediately fired when the service is started. Make sure to stop the service before starting it again if you are using periodic tasks, else it may misbehave.
-
ACTIVITY_NO_KILL The flag is to stop the tasks (like the player) from being killed when the app is alive and the service is being killed.
-
-
-
Alarm
A block to start the service with the exact instant provided. ID is the service Id that will get started when the alarm is fired.
-
Repeating alarm
Sets the repeating alarm for the service with the Id. Time is the instant. Interval is the time between each repeating alarm.
-
Cancel alarm
Cancels the pending/ongoing alarm. Also, cancel the service by CancelTask block.
Know more about the internal features here.
Download
The extension is free for everyone to use.
com.kumaraswamy.tasks.aix (469.0 KB)
Download extension:
Other versions
1.0 - First version
Background-Tasks.aix
[Google drive - BackgroundTasks]
1.1 Version
Background-Tasks.aix
Google drive: Background-Tasks.aix
Version 1.2
Background Tasks 1.2 (382.9 KB)
Google drive: Background Tasks 1.2
Extension for others supportive:
https://background-tasks.vercel.app/
Version 2.0
com.kumaraswamy.tasks.aix (385.5 KB)
Version 3.0
Version 3.1
com.kumaraswamy.tasks.aix (431.1 KB)
Version 3.2
com.kumaraswamy.tasks.aix (455.2 KB)
Version 3.3
com.kumaraswamy.tasks.aix (452.5 KB)
Version 3.4
com.kumaraswamy.tasks.aix (464.9 KB)
Version 3.5
com.kumaraswamy.tasks.aix (467.4 KB)
Version 3.6
com.kumaraswamy.tasks.aix (468.3 KB)
Version 3.7
com.kumaraswamy.tasks.aix (467.6 KB)
About extension
If you've found any bugs, issues or something wrong in this post then lemme know about it. Suggestions and improvements are appreciated
Thanks,
Kumaraswamy B.G