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


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


    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.

  • 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

    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


    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


    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

    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.


The extension is free for everyone to use.

com.kumaraswamy.tasks.aix (469.0 KB)

Download extension:

Other versions

1.0 - First version
[Google drive - BackgroundTasks]

1.1 Version
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:

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

Kumaraswamy B.G


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:


@kumarswamy Best Extension till now


Can you tell me one thing (kodular)

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


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.


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.


See also here:




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


Hello Xoma, will this extension work in Kodular?


He already answered it...


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.


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


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


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?

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?


Cool extension! Thanks for the aia :slight_smile:


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


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