An efficiently designed virtual background execution environment for App Inventor.
Powered by the ItooX framework.
It allows you to run blocks in background the same way you do normally when the app is active.
Please go through all the details and documentation listed below before you try to use the extension or seek help from others. Efforts have been made to be precise and simple at the same time.
You need to be familiar with App Inventor to use this extension. Difficulty level being Medium-High.
π Terminology
It is essential to understand basic terms used in this documentation and in this extension.
-
Background: When we use the word "background", we may refer to two things.
- We say "the app is running in the background" β we mean that some operation is being done while the app is not active.
- The second meaning, we also refer to "background" as in "background service" as opposed to a "foreground service".
-
Foreground: Just like the word "background", this word has two meanings.
- We say the app is in "foreground" β meaning the app is open, being active.
- The second meaning, we refer to "foreground" as in "foreground service" feature offered by the extension.
π οΈ Types of Service
A service is basically something that runs also while the app is not open or when the app is closed.
-
Background Service: A non-visible background work that can be scheduled using Itoo.
-
Runs silently without user noticing it.
-
Vulnerable to being stopped by the system abruptly, can only run upto a few minutes in modern devices depending on the phone brand, OEM, OS installed, etc. (also see dontkillmyapp.com)
-
-
Foreground Service: A user visible and recommended way to execute something in the background.
-
Itoo is primarily based on supporting this service.
-
Generally can work non stop for ever, but could be limited to a few days or less time depending on the phone brand you use.
-
A permanent notification is shown while this service is active starting from Android 8 (Oreo).
-
π Principles of design and usage
To run blocks in the background, you code the blocks normally then use Itoo to execute them.
There are a few things you need to follow while you are using Itoo:
Usage
- Before you try to do something with Itoo, first get it working normally.
- Do not use global variables, or try to access/set them.
- Do not use user interface components such as Label, TextBox or even Notifier since there is no interface in background.
- You cannot use Tiny DB, alternatively you are supposed to make use of the similar storage features Store/Fetch property blocks offered by this extension.
- For the main background procedure, you need to include an argument "x".
- You cannot use normal Event blocks in background, use RegisterEvent block to listen to component events.
- You cannot run more than one foreground or background service.
- A component does not get created until you touch any of its block.
Design Solutions
-
How do you report the status live from background onto the user interface?
- For that purpose, Itoo offers way to communicate back and forth between the user-interface and the background execution using Broadcasting feature.
-
When a new type of block is added to App Inventor, will be be supported?
- Yes, but it may not be immediately supported, it would need an update.
-
When the device restarts, how do I start a background process?
- This can be done using SaveProcessForBoot feature offered by the extension.
-
How do I run a background process 24/7 without any interruption?
- This can be achieved using a Foreground Service (with CreateProcess) block, but do note that some device brand may abruptly stop anything.
-
How do I customize the foreground service notification?
- Update the notification Id (
123321) using the Melon Notification extension.
- Update the notification Id (
π Documentation
- Starts a foreground service, with procedure being the initial point.
Title & Subtitle refers to content of the Notification.
- Starts a background service, latency being the delay, with procedure being the initial point.
JobId refers to a unique service Id to check status and stop the task.
- Useful when you want to start a procedure when the device boots up.
-
Remember, you cannot normally use the Yellow event blocks in background.
Using this, you supply an event name such asClock1.Timerwhere Clock1 is the component andTimeris the event name.So what happens when that event is raised? The procedure given will be called with the same number of values as the Event.
![]()
- Returns true if a foreground process is currently active.
- Returns true if the given JobId is currently active.
![]()
- Stops any foreground process currently running.
Can be called both from background or while the app is active.
- Since TinyDB cannot be used in background due to synchronization issues, Itoo offers a similar set of blocks to serve the same functionality.
- Captures the green property blocks and saves their values.
Then in the background, you can reapply the properties.
- Releases the captured properties of the component. In background.
- There is only a few specific cases where you might use this block.
You can use it to initialise a Firebase or a Cloud DB.
- A way to receive messages from app to a background process.
Name is the message's tag you want to listen to. After message is received, the supplied procedure is called with an argument i.e the message.
- Unregisters a registered broadcast in background.
- When you want to send a message to background or vice versa.
- Once a background service has been started, you can use this Block to call procedures in the background.
- Any messages sent from background will be received here.
![]()
- Returns true if called inside a background process.
![]()
- Customize the permanent notification icon.
![]()
- Enabled by default, produces essential debug logcat to trace errors.
Note: However in the production mode, you should turn it off to not leak any sensitive data in log.
π Resources & Quick Start
Some sample projects that might help you start.
Project files are attached at the end, try to copy rather than simply opening the AIA.
CloudDB with Itoo, update data every few seconds
Here is where the ExecuteInternalScript action comes into play!
Code number 2 represents Cloud DB.
Updates Cloud DB every 5 seconds using Clock.
You just need to change the credentials in the values and you can start using it.
Firebase with Itoo, update data every few seconds
Similarly to CloudDB, we use the ExecuteInternalScript with code 1 to configure firebase.
Writes to Firebase DB every 5 seconds using Clock.
Update your Firebase URL Token & start using it.
Capturing and releasing properties for quick setup
Sometimes you have a lot of configuration in the designer property set and would want to avoid setting them manually again in blocks. The Capture and Release property functions got you!
You can basically save the state of the properties by Itoo and can be reapplied to the component in background.
This works most of the time, but there might be exceptions.
The above example demonstrates how properties Sensitivity and Minimum Interval for the Accelerometer Component is saved and reapplied in the background.
New features in Itoo Sky 4.4.0
-
Ability β Call background procedures from UI
Once a background service is started, you can call a procedure to run in background.
-
Ability β Call UI procedures from background.
Now you can call to update user interface while in background, if your app is open
Wait, what are the requirements?Carefully notice the above blocks.
We are registering theTimerevent ofClock1and we keep track of the counts and increment it by 1 each time theClock1_Timeris called.
Then we call the procedureui_updatefrom the background that will update the count in the label.
So whenever you need to call a procedure to user interface, the procedure name must start with prefixui_. -
Ability β Automatic event resolution system
Beginning from this update, you do not necessarily need to register for events using the RegisterEvent block. From now, Itoo will try to search for a procedure using the naming conventionComponentName_EventNameand call the procedure if it exists.Demonstrating automatic event registration for Timer event of Clock1.
-
Behavior β Now when you click the notification, by default it opens the application. (
Screen1)
Itoo Sky 4.5.0
-
Introducing the Itoo Manifest Generator (theitoo.github.io) for customising foreground services.
-
1.1. Check all the foreground service types relevant to background operations
-
1.2. Check relevant permissions for your use case
-
1.3. Review and download
-
1.4. Import the customised Itoo extension
-
1.5. Check the used foreground service types in the designer
-
-
Deprecated and removed the old RegisterEvent block for statically typed events.
Define a procedure with name ComponentName_EventName with n required arguments.
-
Deprecated and removed JobService APIs CreateTask, CancelTask and IsRunning blocks. Itoo is now a foreground first extension. Use CreateProcess instead.
-
Deprecated and removed, unpopular CaptureProperties and ReleaseProperties blocks.
-
Deprecated and removed old communication blocks Broadcast, RegisterBroadcast, UnregisterBroadcast, and BroadcastEvent blocks. Use the new auto communicators added in version 4.4.0.
Download
Please head over to theitoo.github.io to download a customised and Playstore compliant version of the Itoo extension.
Generic version: xyz.kumaraswamy.itoo.aix (89.8 KB)
Templates
| Usecase | Foreground Service Type | Download |
|---|---|---|
| Hobby and regular testing | Connected device | Itoo Manifest |
| Background audio players | MediaPlayback | Itoo Manifest |
| Background location access | Location (accurate+rough) | Itoo Manifest |
| Background bluetooth communication | Connected device + BL permissions | Itoo Manifest |
Open Source
The Itoo Manifest Generator is open-sourced under the GNU GPL v3 license:
Acknowledgement
I want to thank Vitor Mori for sponsoring this version of the extension.
I apologise that I was unable to provide an update earlier. I've gotten better now.
Donate
I'm an high school student. This is not an easy extension to maintain. Only possible with incredible hardwork and months of research for perfection put into it.
Please consider donating: PayPal.Me
Project files
All of the project files listed below uses version 4.1. Please upgrade if you target Android 14+ onwards.
SimpleItooProject.aia (81.9 KB)
SimpleItooCloudDB.aia (82.2 KB)
ItooFirebaseDB.aia (82.1 KB)
PropertyCapture.aia (81.9 KB)
More Examples
- Itoo with Notification listener β by Taifun
- Battery checker reminding you to unplug when fully charged β by Taifun
- Creating a music player to run in background β by Kumaraswamy
- Creating alarm manager from scratch β by Mario
- Streaming never ending radio β by Mario
- Pedometer with Itoo β by Mario
- Chat with push notification (CloudDB and Itoo) β by Mario
- All type of Push Notifications using Itoo β by TimAI2
- Run app in background, that fires an alarm whenever phone is shaking - #4 by Taifun
Turn off device specific battery optimizations: dontkillmyapp.com
Extensions Featuring Itoo(x)
- Alarm manager by Taifun
- Locationservice by Taifun
- Notification listener by Taifun
- Phone State Listener by Taifun
- Geofence by Taifun
π Extension
This extension can be freely used, including in appathon.
Both extension and framework are open sourced under the GNU-3 license.
By default, the extension does not ask for notification permission.
*Use the AskForPermission block
Thank you
Kumaraswamy B G


































