Background Tasks extension [3.8 A] 🥳

Okay after some works and tests, found a way to call App procedures in the Background, which makes it possible to directly use procedure blocks in the background. :grinning:

3 Likes

Great extension :slight_smile: . I'm always reading this topic to see updates!

2 Likes

hello,
I'm trying this extension to include it in my app. The goal is to prevent the device doze mode when I run my app and also not consume much battery. I have set it to only 5 seconds to test, but I would like it to work with any time interval.
But it doesn't work for me in the 2 ways I have tried. What is the error in the blocks?

Thanks

3 Likes

@kumarswamy or someone can help me please?

1 Like

I am not sure about those things :sweat_smile:

1 Like

but you created this extension, didn't you?

1 Like

Yeah, but in your way, I'm not that expert.

A simple foreground service can be applied.

1 Like

You download the 4.0 from here:

I havent released it here yet.

1 Like

Hello @Kumaraswamy
I am not a professional, I am an amateur and in my free time sometimes I dedicate myself to make an app with inventor and I am learning.
I just wanted to make the app work internally even when the screen is locked. I found a solution but I think it is not very suitable, and it consists of putting a player to play an mp3 file without sound. This way I managed to get any process to work even when the screen is locked, but I think it must consume a lot of power, that's why I wrote in this forum.

by the way about doze mode someone told me that this could be the problem, but I don't really know what it is....

1 Like

As per my knowledge, foreground mode helps a little escape the doze mode. But it cannot fully stop that.

This differs on various devices, on Samsung, the foreground mode will be killed just after 5 - 7 mins in case app is cleared out. You have to also give necessary permissions (disabling battery optimizations and other things) for it to work long.

1 Like

This got it working with the foreground mode. When the player is completed, choose different source of audio and play that (playlist type).

1 Like

Thank you very much! I'll try it out and see how it goes!

2 Likes

Hi,
I have tested the blocks (on my device with android 12) and what I see is the screen stays on all the time.
Actually my idea is to run the playlist when the screen is locked. Is it possible to do it?

2 Likes

That should be possible, I had forgotten that the extension will flag android to make the screen stay all the time. An alarm triggering it should probably get it work, escaping the lock doze mode.

1 Like

@Kumaraswamy
i have tried with alarm and also keep the screen on all the time (android 12)

1 Like

Hi, there

I'm trying to buid an app to send sms at a schedule time.

I've started by the sending part but it doesn't work

Can you see why?

Thank you!

1 Like

Well sorry to bump this topic but i think @ABG (sorry for mention) you should add this in -
FAQ Section: Background Services - Frequently Asked Questions - MIT App Inventor Community

2 Likes

This is a very long thread. Which post should I link to from that FAQ?

1 Like

probably the the first post? -
Background Tasks extension [3.8 A] :partying_face: - Extensions - MIT App Inventor Community

2 Likes

(added to FAQ)

5 Likes