Background Tasks extension [3.8 A] 🥳

You can use it!

2 Likes

I, Kumaraswamy, attest that I am the author of the
Background Tasks extension, grant that the extension included in project
is free and that MIT has a non-exclusive irrevocable license to
republish the extension as part of the project file for the purposes of
the MIT App Inventor Appathon 2021.

2 Likes

hello sorry, can you show me your blocks? I too can't get SimpleNotification to work

i don't understand where this block goes ... i can't get it to work

Hi Iomedesimo, use that block at the last.


I begin to understand how it works ...
however I cannot dynamically call .Start (in fact the first returns True but the others False).
I have a list of items [ms, name, desc], but it only works with the first item

You are calling two blocks that starts the service.

They are Alarm which is used to start a service at a particular time. Then you are also calling the Start block, you are trying to start two types of services (Alarm & Normal).

When Alarm blocks is called, the task list is cleared (this type of behavior because its annoying most of the time to use ResetTaskList block). The Start block will just save the empty values to database because its already cleared when Alarm is called.


excuse me,
the right block is this ... alarm I added it to test the sound.
without alarm it starts only the first element of the list

to make a sound I'll think about it later :smiley:

The blocks looks correct. You have set the SimpleNotification value for the notification Id as 1 that will remain constant, the notification will just get updated.

I don't know is this is the problem, but set an unique id for it.

Is the return value False when the Start is called the second time?

I just realized that you are just creating one component that will only work for the first time or the first round of the loop.

You should try creating the component in the Loop instead. The extension will automatically reject the process and return false just to prevent unnecessary/not working/redundant tasks.

1 Like

yes, you were right, I put the CreateComponent block inside the loop and it works. thank you very much...
now if i wanted to make a sound what could be the right approach?
I tried to create a Sound component but I couldn't...
PS: I publish the correct block, maybe someone can use it

1 Like

Please post your blocks here so that I can check them. It is posible to play a sound in the background.

Your welcome!

here is the block that follows the same logic as before but does not emit any sound (obviously the audio file has been uploaded)

You are not setting the source of the Sound component.

26.07.2021_18.55.07_REC

Like the above block, create a function that sets the source and call it.

i can't ... i feel stupid :frowning:
that then I saw that in a xiaomi the SimpleNotification does not make any sound by default, while on a samsung it plays the default sound, but in none of the 2 cases my audio file is played

Well its me who spend hours looking into a single small bug :crazy_face:


Here you are creating two functions of the same Id, so it will not work.

After changing the function Id and the values in the CallFunction blocks with unique id (values) , first call the function that will set the source before calling the play function.

Also be aware of the restrictions on Xiaomi devices, follow this article:

Turn on Autostart and you may remove battery-restrictions (in case for long term process) both from the App settings.

as always you were right ... the ids were different only the order of the function calls was wrong

1 Like