[Discontinued] Background Tasks [4.1] 🥳

Thank you

I will try this and get back.

1 Like

Yes, call it just after creating the component.

1 Like

Hello Mohan, did that work for you?

I tried something similar didn’t work for me my app just stops working.

You have not shown me your blocks.

My app keeps stopping similar to last time when I tried to send notification daily.
You said it was due to some intense load or something.

You should not just say it’s stopping.
There could be several reasons for this.

Give me some more details.

I sent you aia the last time. My was like freezing after creating that background task. It rarely happened in test apk though.

Are you saying the texting component does not work…?

I try using any background task in that app I sent you
It freezes once I click on create background task .

Actually, that should not happen. It’s just a few tasks.

Which test APK are you talking about? And extension dosent work in companion.

APK with nothing in it just the task extensions and component on screen 1. It doesn’t freeze. Do you think this is my device error?

No, send me the APK in PM.

I was just inspecting why this was happening and I found out why it freezes.

The MakeDelay block is for some reason is executing on the main UI thread of the application and freezes for exact 60 seconds (thats 1 minute) according to the logs.

ActivityService: Task values: [60000]

@Titan_geek You should remove that block, I am not sure why it’s happening, it was not the case in version 3.0 of the extension, running on a non-UI thread.

And look at this post below, you should use latency instead.

My internet is kinda slow it is taking a lot of time to download and send apk.
To_do_proto.apk (5.6 MB)

So I thought specifying time and comparing it would solve it. It will send notification everyday.

Using latency doesn’t solve my problem.

Reason is the actual task of delay.
I used it to fire timer after reaching the exact time user wants to get notification and start 24 periodic timer

Using periodic tasks (in the next update) with the latency is the best solution.

It’s just a bad thing to keep the service running and waiting for the exact time, moreover, in the high-end devices, the system would just kill the service.

The extension uses the internal API to set the latency, and it’s not always accurate and will never be. Even though the extension specifies the max latency for it, but that would not really solve the problem.

You should however wait for the next update. :grin:

I actually should try using google calender and set notification untill your next update. But it won’t redirect to my app haha.

Though I get confused about how things lik event gets fired if latency is high Like what if you get text message in between.

I don’t code so I donno.

1 Like

Events would be continued to trigger and work until the service is alive. Once it’s killed, the extension stops its operations.

It is just okay to run long term operations with the extension.

With the periodic timer, the service would just be started by the period timer. Periodic tasks don’t always keep the service running. They instead start a service when it’s needed to do so.

Also, the system tries to start the service in case if the service crashed.

1 Like