Doesn't work on all phones...
Hi Sunny,
I am Salvatore, I well remember about you, I got your help some months ago to include Deep Link feature in an AI2 app of mine: thank you again for your valuable and effective support, you were very nice.
I take occasion to get in touch with you again in this specific thread, because I have noticed your GitHub project of an AI2 extension for background tasks (https://github.com/vknow360/BackgroundTask) and I would be quite interested about that. Nowadays, is your extension ready and usable? Could you compile and release it in AIX format and provide some documentation and example as well, please?
Hoping for your kind feedback. Cheers.
Salvatore
Hi @Salvatore_Oliva
Unfortunately, I have stopped working on that project due to time limitations.
I am sure that will be completed in near future.
Hi Sunny, thank you for your kind feedback.
Please, keep us informed about that project of yours, the attention on it seems to be high. I am very interested in it and several other people and I would like to see it completed and get published here in the community. I do believe it would be a strong success. I would be pleased to be personally informed when the project is ready and I can offer my availability to test and debug it.
Hoping to hear from you soon. Thank you again, my deep respects.
As I said before, this extension has nothing to do with a → Background
service, it is all about a → Foreground
service in order to prevent → Doze
mode from becoming active.
Note: And a Background
service has no effect on Doze
mode.
Thank you soon much for the extension.
It works perfectly on my phone. My app is running in background and triggering the timer perfectly.
Thank you soo much again.
Hi Anke,
How we can solve this problem.
I'm trying to write an application with a time counter.
The app sleeps after a while even when charging
Show your blocks.
And did you enable TimerAlwaysFires
?
Yes Anke,
But 1 or 2 min. is sleeping applicaiton.
And even when i add it to "never go to sleep" section from andorid settings the app is still sleeping!...
What is your goal? Do you only want to keep the screen on?
Or do you claim that the timer does not work in idle (sleep) mode even when the device is charging?
My aim is this;
I want the application I wrote to continue to run in the background.
The user ran the application.
The seconds began to increase. It also started increasing by +1 on a counter.
User switched to Instagram. Or turned off the screen, the screen is now black.
I want the application to keep counting the seconds, the counter to keep moving.
I wonder if I could explain
Ok, the reason why the timer stops in background / idle / sleep mode is that Doze mode strikes and shuts down / throttles all possible functions (CPU, WiFi, timers, internet connection / LTE etc). But that shouldn't happen while the device is charging. I've checked this on dozen of devices running all versions of Android (for years).
In order for it to work without charging, a Foreground service is definitely required. Search hereafter in the forum and you will find my answers / solution (AI2, Kodular, ...).
Last here:
Hi Anke,
I am a Sansung Galaxy A50 and Android 11 version user.
The timer stops while the phone is charging, it definitely lags behind.
At the same time I am running a stopwatch on another device.
There is a very obvious difference between them.
What duration are we talking about? 5 min?
It is well known that the Clock
component is not accurate. It is always something lagging behind, which is clearly noticeable over a long period of time compared to a chronometer. On average (device-dependent) the timer loses around 1 second per minute.
Definitely in a 20 minute experiment, 5-10 min. lags behind. After the first 1-2 minutes, my application stops (sleeping). It doesn't work until I call it back to the screen. I don't care about milliseconds anyway. It's enough for me to be the same for about seconds. do you understand? For example, I am making a taximeter. I am making a bike rental application.
Ok, I'll check this again on my 16 test devices (Android 4.x, 5.x, 7, 8.x, 9, 10, 11).
Maybe something has changed in the meantime ...
Thank you so much.