[Discontinued] Background Tasks [4.1] 🥳

That still will stop working when user leaves your app. You still need foreground service to keep the timer running.

1 Like

@Xoma
am testing the extension with firebase but after 10 minutes it stops responding
Is there a way to extend the time to 5 hours?

For that, you have to disable battery optimizations or set Repeated Mode to “High”.

2 Likes

@Xoma
Is the extension compatible with the JsonUtils extension?
the JsonUtils extension helps manipulate the json response of the firebase DataChanged

Short answer, yes. Long answer, yes it is

1 Like

Please tell me what I’m doing wrong

You do know that 4.0 version supports procedures? You can use jsonutils as you normally would in a procedure you just have to call that procedure from background task. You can find example in this topic.

1 Like

If you want to use it in background then here is an example.

2 Likes

@72erdelyi
I am tired of all the experiments I did, especially after all of them failed.
Can you help me make the timer work outside the app

@Xoma
Hi, I am working on an app and I want the timer to work in app pause mode (app doesn’t close) is it possible to work with this version extension or should I wait for version 4.1
Knowing that I will download the application from the Play Store, does it work with all Android devices?
Thank you very much
And if one of the activists has an answer to my questions, I hope he will answer me

I already suggested you an extension which would be the easiest for you to achieve but you said you would go down on a different root. I don’t even know what you are trying to achieve

@72erdelyi
I really looked for the extension you suggested above me (Survival) but I couldn’t find it.
My goal is when I press a button that floats a component on the main screen and I did this and it actually worked. I want a temporary start when I press the same button (the button that makes the component float) but this didn’t work when the application goes to the phone main screen (we think it is in stop mode) so timer not working

here it is Ullis Roboter Seite/AI2 Keep Alive
this will start foreground service which will keep the timer alive. If you don’t want setup message in the notification then all you have to do is to start keep alive service. Anything that works when the app open it will work when upp is running in the background but it is not closed.

The only reason i suggested this extension because you don’t have to modify your existing code. You can achive this with this background task extension as well but you have to redo many things

@72erdelyi
Thank you very much
Coming home I will try it. Finally, if it works.
Thank you :heartbeat::heartbeat:
Do you think it works with all Android versions?

1 Like

ForeGround services were introduced with SDK version 26 (Oreo 8.0) so anything below will not work.

@72erdelyi
Is there a version less than 26 and it works fine so that I can use it in my application :cry:

there was no foreground services previously. not many uses android below 8 these days. i wouldn’t worry about that.

Otherwise, it uses the wallpaper.
But I will have to change some orders as I said and I don’t understand and I don’t know what to change :cry:
@72erdelyi

I can’t even test the app on my phone because its 5.1.1 :cry::cry:

Make Extra is not in the new version


try these blocks but it doesn’t work (excuse my ignorance)