ItoO - Background Tasks [special] 🥳

also works for me , great idea , but the only problem background service work only for 10 minute after that it will be killed , any idea how to solve this ??

2 Likes

Oh! Haha, didn’t know what you meant, still newly testing this between work - thanks :grin:

1 Like

Yes, that is true, depending on the type of phone you use, it will be killed accordingly.
What you have to do is, set battery optimization for the App to false and use Periodic block.

2 Likes

i have used InitializePeroidic Block, its not working properly with me the service going to be run only one time .

im using VIVO x70 pro

Completely turn off the battery optimization, and phones like Vivo, MIUI and samsung will heavily delay the execution to save battery.

Version 1.3 A

A new release is out :partying_face:

  • Boot System
    image

    From this block, you will be able to call a procedure by name, same as initialize block but when the device gets switched on/phone restarted.


  • Clear Boot System

    image

    A block to remove the boot system set (resets it).


  • State

    image

    Returns true if the app was/is active when the service was started.


  • Use Alarm API

    If set to true, the extension will use Alarm Manager API which is more accurate than the default API. This block is for Periodic tasks (InitializePeriodic block).


  • Initial Periodic Trigger

    Use this block when Use Alarm API block property is set to true. This block is to specify the first trigger (in ms) of the periodic table.


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

11 Likes

This is great work… but there are some notes, I don’t know if they are mistakes or not…

1 - When we try to click on cancel, to stop the service, the service does not stop until after closing the application.

2 - The service does not work while the application is running, even if it is (RunWhileActive = True), the application must also be closed like we do when trying to cancel it.

3 - When the application is closed after the specified time to run the service, it does not run until much longer than the specified time, such as 20000 instead of 4000 … This does not happen when the application is closed before the specified time.

4 - It would be better if there is a block that informs us if the service is running or not.

1 Like

I will look into that.


Yes, when the app is active, the extension normal calls the procedure and forgets. Here “When” block isn’t going to work (so in your case it doesn’t work, you need to also add a normal event).

And this is linked to my above answer.


:+1:

1 Like

Is it possible to run loop in future?

1 Like

For Android 8+ ?

1 Like

@Xoma, Is this correct blocks to use Periodic Tasks ?

2 Likes

yes confirm

1 Like

That is actually the default behaviour.

I have an APP that must do a check and a send notification if alarms exist.

I’m using a API REST GET with format json.

The REST GET in background isn’t working but it’s fine when the app is active.

When I use Conect Al Companion, I get the following error:

Attempt to invoke virtual method ‘int java.lang.Integer.intValue()’ on a null object reference

My app is this:

Please can you give me a ligth?

1 Like

Hi welcome.

Please compile the APK, it will not work in the companion.

Thanks!

I did it but I have a problem in background

The Web1.GoText it was not executed.

Only it fine in active mode.

When App active I see the debug alert first, second and third.
When App in background I see only the debug alert first and second.

Thanks a lot.

Can anyone here bring an aia that performs background action with this extension? To perform a simple operation, the main thing that I can understand how to work with the extension through the file

Hi, you have to use the “When” block to register the event with a procedure name that will receive the arguments :blush:

1 Like

Why does it not work for me ??
!
IMG_20220427_235649

It does not show me the image it was supposed to display.