[Discontinued] Background Tasks [4.1] 🥳

hi i’m new testing your extension, i’m just trying to get it to work.

Greetings.

blocks(7)

blocks(6)

blocks(5)

blocks(4)

Hi, you cannot use the label (visible components) when you have called the procedure.

Also you are missing an argument to provide empty args.

2 Likes

blocks(27)

It should be like that above.

1 Like

Wow! it’s great.

Now it works. Thank you

1 Like

Can you make an example for “Firebase Filter” with current version? This will help a lot of users.

1 Like

Yes maybe, there are some things changed since then.

I had tested firebase with 4.0 some days ago.

Do you think that with those same blocks, I can run this procedure?
I will try anyway, I’m sure I don’t have any visible components.

I’ve been waiting for this for a very long time. I am grateful to you.

1 Like

Yes in theory that should work, but not sure about that notify component.

1 Like

I’ve been watching your extension updates for a long time, and today is a great day for me.
the procedure is working correctly.
I am very grateful to you.

1 Like

I am very happy to hear that :blush:

1 Like

In the TimeOut property, what could be the maximum value?

7000 is the default value?

There isnt any maximum value about that.

My procedure has worked correctly, but I’m not sure how the foregroud service works.

Once this TimeOut has been reached, is the process killed and automatically restarted?

My phone is xiaomi and it has many restrictions, every x time the service closes and starts again, but it is not a defined time, it is random.

I will have to do tests on other devices.

When the timeout is reached the service is killed.

Not sure about the random thing, can you explain it mroe?

A simple example that shows a notification on every data change event.

Since the extension has the LoadTemplate feature, we can use that. The template template.txt is located in the assets directory.

template's content
t.create("com.google.appinventor.components.runtime.FirebaseDB", val0);
t.invoke("set-firebase-default-url-dynamic", val0, "DefaultURL", new String[] {val1});
t.invoke("set-firebase-normal-url-dynamic", val0, "FirebaseURL", new String[] {val1});
t.invoke("set-firebase-token-api-key-dynamic", val0, "FirebaseToken", new String[] {val2});
t.invoke("initialize-firebase-database", val0, "Initialize", null);

24.11.2021_13.55.46_REC

In the designer properties, you should check the “Repeated” value and set “RepeatedType” to High. This will force the restart of the service intensely when stopped.


There may be some little problems while using the restarted properties, when the service is restarted the values are updated so the notification may trigger again. Setting a project bucket manually should make the situation better.


DataBase.aia (461.7 KB)

3 Likes

Good evening.

Background Tasks [4.0]
Take a look at the blocks:

Xiaomi phone - Android 5.1 (API 22) MIUI
Xiaomi phone - Android 6.0 (API 23) MIUI

Not working - app shuts down after start of task.

Xiaomi Phone - Android 8.1 (API 27) MIUI

Works, but after closing the app completely, it stops.

Phone on Android 11 not MIUI - works as it should.

Am I doing something wrong?

Hi, if you are using foreground mode in Android below 7, because of a bug, that wont start.

If the application crashes, it maybe a different issue, you can PM me the APK or AIA.

MIUI requires autostart permission to run in the background in case you clear the app from recents.

2 Likes

hey, did you set the app to no restrictions under energy option

2 Likes

Also, If you are using foreground mode, you dont need to create those blocks, alternatively you could just call a procedure that will do that easily.

2 Likes