Background Tasks extension [3.8 A] 🥳

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



Documentation

Here is the documentation of all the available blocks. If you have found a mistake then let me know about it. :smile:

  • Creating a component

    04.04.2021_11.01.36_REC

    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

    04.04.2021_11.03.06_REC

    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

    04.04.2021_11.03.36_REC

    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

    04.04.2021_11.04.04_REC

    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

    04.04.2021_11.04.46_REC
    Creates a variable with the specified value and the variable name which you can use it on functions.

  • 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

    04.04.2021_11.20.39_REC

    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

    04.04.2021_11.22.14_REC

    I strongly recommend using this block. Mostly on Chinese devices which requires additional permission to run tasks in the background.

  • Finish task

    30.06.2021_22.29.07_REC

    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

    25.06.2021_10.39.32_REC
    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

    04.04.2021_11.24.02_REC

    Cancels the service by the given service ID.


  • Registers the event

    Screen Shot 2021-06-21 at 08.54.11

    Registers the event with the function ID and event name The function ID will be called with the event values.


  • Cancel all tasks

    25.06.2021_10.42.14_REC

    Cancels all the pending tasks.


  • Destroy the component

    Screen Shot 2021-06-21 at 08.56.10

    Destroys the component and its registered events.


  • Extra function

    26.06.2021_18.31.14_REC

    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

    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.


  • Reset task list

    30.06.2021_22.26.00_REC

    Clears the task lists and all the functions (Create components, functions, events) and others.


  • Pending tasks IDs

    30.06.2021_22.26.58_REC

    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.

    17.07.2021_19.17.37_REC


  • 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

    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

    Screenshot 2021-07-18 at 14-51-04 MIT App Inventor

    Sets the repeating alarm for the service with the Id. Time is the instant. Interval is the time between each repeating alarm.

  • Cancel alarm

    Screenshot 2021-07-18 at 14-51-04 MIT App Inventor

    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

com.kumaraswamy.tasks.aix


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 :smiley:

Thanks,
Kumaraswamy B.G

65 Likes

Now I can use best extension in my app rather than a paid one :slightly_smiling_face: thank you for the extension may god bless u :cat::heartbeat:

6 Likes

@kumarswamy Best Extension till now

6 Likes

Can you tell me one thing (kodular)

Can I run My Exoplayer in background exoplayer stops after some min

3 Likes

You should be able to run any components which don't refuse to start in the background. I will confirm it because my extension works everywhere except kodular (I am not sure why it's like this).

Post: my extension doesn't support Kodular since there are some issues related to services.

3 Likes

No, you need a Foreground service for this as this has to do with Doze mode and has nothing to do with a Background service / task.

5 Likes

See also here:

https://community.kodular.io/t/backgroundtasks-extension-paid/73771/75

5 Likes

Wonderful!

4 Likes

Rush may solved or edit Manifest?) :+1:

3 Likes

Hello Xoma, will this extension work in Kodular?

2 Likes

He already answered it...

2 Likes

The extension is innocent and now anybody can feel free to use it :slightly_smiling_face: without any problems. The extension will receive regular updates and more features.

@Moderators please delete all the off-topic replies :slightly_smiling_face: to avoid creating mess or hate replies.

5 Likes

2 posts were split to a new topic: Why does this warning appear This topic will close 7 days after the last reply

May change this icon to another,? thank
Screenshot_20210320-201313

3 Likes

@Chudesa_Bojii Yes you can change it but not for now at least the next version would support various things and customizable features :grinning:

5 Likes

This is very interesting.

Could you also post the .aia export file for your sample, to help connect
the three component blocks you refer to

  • NotificationStyle
  • TinyDB1
  • Notifier1
    to the app's Designer components?
3 Likes

BackgrounThings.aia (359.1 KB)

Here is the test AIA file. I have tested my extension on Android 9.1 and Android 10. Please let me know if you face any issues :slightly_smiling_face:. And I don't understand what your saying in the last line?

5 Likes

Cool extension! Thanks for the aia :slight_smile:

4 Likes

I have also tested it in Android 11 too, and it works just fine :)

4 Likes

Finally :sunglasses: now my app run in background amazing :blush: thank you very much :slight_smile:

3 Likes