Background Tasks extension [3.8 A] 🥳

Hi @Kumaraswamy
Thanks for the extension. I want to use this etension with BluetoothLE but just when I insert the BluetoothLE extension in the mit app inventor, the app does not create a background service. Has anyone faced this problem? What could be the possible cause?
Thanks

1 Like

Great extension @Kumaraswamy

2 Likes

Bluetooth components are not supported and the development on this extension is no more. You need a foreground service.

2 Likes

Yepp, they require app to be either open or in foreground

1 Like

this will not work for the Kodular environment. however, it is here that you will find the necessary extensions, including for Kodular :
https://ullisroboterseite.de/android-AI2-KeepAlive-en.html
checked. it works perfectly.

1 Like

Hi Yeragi, have you been able to solve it?

Please return UI in new version)

Hi looks great, I want to make an app that stores
Data from telephony extension in tiny dB, every change in Cid and rssi , is it possible?
Can you help with example to store value in tiny dB?

You should try previous version with the example given above.

Unfortunately i couldn't do it. The BLE extension in the MIT app inventor is linked to the main form and once the application is destroyed from the tasks (swiping up), the BLE object is destroyed. So to use this extension, I would have to modify all the other extensions, which was too much work for me.
I just switched to android studio and had my work done

any examples of tutorials in video form?

Is this still not working with Kodular?

2 Likes

at request of @Kumaraswamy

Extension version 3.0

I've released the new version of the extension, and here are some tutorials:

  • Quotes

    WebFetch.aia (428.4 KB)

    It's a little complex tutorial to show quotes/thoughts from web between every interval through the clock component with events and showing a notification with the Notification Style extension for a fixed amount of time.

In some cases, the app stops because the clock component takes much time to create so the extension just executes the next task without waiting, there is a fix pending for this. But most of the times it works fine.

  • Light sensor and file

    LuminanceFile.aia (399.5 KB)

    Simple project to write down the light sensor's event values to files and may require storage permission.

  • Not working

    It may not be working on every device and may behave differently. Avoid testing on the emulator. If you have Redmi devices, try enabling the Autostart permission or use the resolve activity block.

  • Simple example

    MemoryNotification(1).aia (452.4 KB)

    Blocks


    photo_2021-06-21_13-55-49

    This simple demo to work with the FileTools component of vknow. This should work in every device as the requirements are met. A notification will show you after a constant amount of time.


    Fun fact: extension found working on Android 5.1!

5 Likes

Finally It came back !!!

Will Give it a Try !!!!

:smiling_face_with_three_hearts:

Awesome news!!

Keep it up!

:partying_face:

nice @Kumaraswamy !!

Extension 3.0 A :hugs:

  • Re-continued the extension :smiling_face_with_three_hearts:

  • Added event blocks that can call functions.

  • Component support (The extension doesn't let any component like (example: player) kill itself when the app stop or destroy)

  • Foreground support that will let you run apps like a music player!

  • Important: Stabilized much more! The extension supports firebase, other components like clock etc!


Demo blocks


Here, after 5 seconds of latency, we will send a value to the firebase database of value tag text .
For more tutorials check out my the above blocks (they are 80% the same) after going through Q/A in this post;

The extension is created with Rush and the same for AppInventor, Kodular, etc...


  • Upcoming features

    • Possible interaction with the main application from the service.
    • Periodic tasks (normal job service) that help you execute tasks frequently.
    • JSON input which will allow you to take the input tasks as JSON and execute it.

  • Question: Why we are calling the Initialize block of firebase?
    It's because the firebase components need to re-initialize this way when we use it this way (dynamically).
    It's the same for components like LocationSensor and others as well.

  • Question: Why components on UI thread?

    It's because components like Firebase, Clock and other components MUST be created on the UI thread to initialize. This thread consumes a little more time to create components than default ASYNC. The extension will wait for the creation of the component as in the earlier(Ai2 thread) some days back issue.

  • Question: Will it work on Android 5?

    Yes, it should work, at least most of them. It may be late for the system to create a service but should work; as the test on Android 5.1.1


    Is Kodular Compatible New 2.1

7 Likes

Hi,
How can i do if statement in event? For example if event value == 2 call function 1 else call function 2.
Is this possible?
Thanks