Open Source • Background Tasks: Itoo

Itoo 4

Graphics by Dennis Littawe

BuildWithLove Frame 1

The newer version of Itoo now has updated ItooX framework which runs more reliably across all platforms, devices and Android versions.

Services

Itoo supports two types of services.

  • Foreground

    • keeps the service alive throughout the session without interruptions.
    • a permanent notification will be displayed throughout the session from Oreo.
  • Background Task

    • unlike the foreground task, it is executed on a different process.
    • vulnerable to unexpected / sudden shutdown by the system (especially Samsung, Xiaomi devices).
    • the running task should be completed within 10 or 30 minutes depending on the Phone brand.
    • it is possible to restart the service from then, by setting the restart property to true.

Blocks

  • Create a foreground process

    process

    • A block that will create a singleton instance of the foreground service.
    • the process never ends, unless killed by user / system.
    • procedure: procedure to call when foreground is started.
    • title and subtitle: right now, the extension supports to only change title and subtitle of the foreground notification.
  • Create a Background Process

    background

    • A block to create a normal background service that should finish within 10 or 30 minutes.
    • latency: the time delay before the start.
    • jobId: the id of the background service.
    • procedure: procedure called when the service is started.
    • restart: specify true if the background process should be looped.
  • Ends the current foreground/background service, can be called both from inside/outside the background service

    StopProcess

  • Check if background process is running

    check

    • jobId the Id of the background service.
  • Cancel the background service

    cancel

    • jobId the Id of the background service.
  • Create with trigger

    • the above block calls a procedure when charger is connected to the phone.
    • the extension can also listen to actions, when the certain action is performed, the respective procedure gets invoked.
    • action: Intent action as a string.
    • procedure: procedure to call when the action is performed.
  • Register events

    events

    • eventName: component name and event name combined, like Clock1.Timer.
    • procedure: procedure called when the event is invoked with the args.

Version 2.1 Changes

  • Added methods to store values

    FetchProperty

    StoreProperty

    • They are like Tiny DBs of Itoo, these blocks can be used in the background services, especially for non-foreground services to store and fetch properties. They provide special connectivity between services and and the application realtime.
  • Added Boot Receiver Block
    The functionality has been reintroduced.

    image

Version 3 Changes

  • Added a way for one way communication b/w foreground/background process

    RegisterBroadcast

    • Registers a broadcast with a name and a procedure as a listener.
    • In simple, this will listen to a particular event that will be sent by the application outside the foreground/background service.
    • Corresponding procedure must include an argument that will contain the message sent.
    • To be used inside the foreground/background service.
  • Broadcasts a message to the foreground/background service, message can be anything

    Broadcast

  • Unregisters the broadcast listener previously registered

    UnregisterBroadcast

  • Returns true if a foreground process is active

    ProcessRunning

There are a lot more changes internally :-) but simply not relevant to know

Version 4 Changes

  • Any message sent from the background service will be received by this event

    component_event

Resources

Notification every second

Notification when charger is connected.

Framework

The framework (open source) is the core of the extension, it creates a custom environment, creation of components, handling of procedures and events.

Extension

Both framework and extension is open source.

Download: xyz.kumaraswamy.itoo.aix (66.8 KB)

Donations

It takes a lot of time to develop, maintain and update the extension time to time.
Especially the itoo-framework.

You can support me via

Stripe, PayPal

Note

Do not ask for me to help you with preparing blocks, unless you have tried something.

Please do share what you have achieved with the extension :wink:

Thanks!

37 Likes

Awesome work @Kumaraswamy :+1:t2::+1:t2:

5 Likes

Great extension Thank you so much @Kumaraswamy

so by using this extension i can run a procedure on phone boot starts up ?

4 Likes

Did you read this?

5 Likes

Hi, am I missing something in my blocks?

I have just checked Developer Options --> Running Services and this background service is not listed there. I have make not optimized of Battery also.

1 Like

You have to drag atleast a dummy Texting component into the monitorSMS before you call the "When" block.

Thank you Kumaraswamy. I did that but no luck. would you like to look into my aia once?
DSOMonitor.aia (29.4 KB)

4 Likes

Hello,
good morning,
I have a problem,
I have made the program, and it works to send a notification in the background, but after a few hours, it stops working.
I have tested it on two mobiles: Motorola and Samsung.
I attach my blocks in case I left something.

image

Thank you very much for your help.

1 Like

Yes, there are two ways to solve it, completely disable the battery optimization of the app in the app settings and turn of phone battery optimization.

The other way uses a foreground service, i will soon release an update (in a week)

2 Likes

Ok, thanks

2 Likes

Unfortunately, the video is not displayed with either Firefox or Chrome.

2 Likes

But for example, how WhatsApp does to receive messages (in the background) without showing any foreground?

1 Like

They are whitelisted by the device manufacturer and they use the tools provided by the Google like GCM/FCM which are more reliable.

1 Like

Oh
Thanks :grin:

2 Likes

not wok for me

1 Like

Share your hardware version and your relevant blocks.

blocks
my block i'm using android 10.

2 Likes

No, you cant show AlertNotice or any kind of UI from background.

So how work on boot please show an example.

1 Like

I have to yet update the extension framework, it has not been updated since months.

1 Like