Open toonvanstrijp opened 3 years ago
Is it not running at all or is it running and get stack after the refreshForegroundServiceContent
?
I found a bug that the refreshForegroundServiceContent
isn't finishing which makes the thread to wait for the function forever
so maybe it because of that but I don't know yet. I will test it and I will let you know
I think I found the problem, when the OS stops the service the task restart its delay and not continue it from where it stops so if you use a long interval time and the OS kills the service before the task execute it will never run
I will fix this on the next update
I uploaded a new update (0.1.7) which should fix this problem Let me know if it fixed or not
sorry for not opening new issue but startPeriodikTask is not working when i activate the screen lock. if i close screen lock then startPeriodikTask is going to work well. So is there a way working on screen lock?
It's doesn't always work for me, don't really know what the problem could be. But I think it has to do something with the battery optimization done by android. And when the phone is in doze mode it also doesn't run on the given period.
sorry for not opening new issue but startPeriodikTask is not working when i activate the screen lock. if i close screen lock then startPeriodikTask is going to work well. So is there a way working on screen lock?
It's doesn't always work for me, don't really know what the problem could be. But I think it has to do something with the battery optimization done by android. And when the phone is in doze mode it also doesn't run on the given period.
Which phone do you testing on? Maybe it is because doze mode and standby mode but I don't know yet. It is not easy to test this stuff because every phone works differently. I will do my best
redmi note 4.x.
and one issues too. For example foreground service time duration is 10 seconds. And startPeriodicTask is getting 20 seconds. So foreground service opens a new startPeriodicTask instance. Thts a problem. ForeGround Service must be wait the startPeriodicTask is finished then. Foreground service time duration should be start, i think.
redmi note 4.x.
and one issues too. For example foreground service time duration is 10 seconds. And startPeriodicTask is getting 20 seconds. So foreground service opens a new startPeriodicTask instance. Thts a problem. ForeGround Service must be wait the startPeriodicTask is finished then. Foreground service time duration should be start, i think.
I fixed this problem in the last update (0.1.7). When the OS stops the service and the timer (task) is running I added a calculation to the new created timer which caclute the delay. For example if the period is 20 min and the service killed after 10 min the delay will be 10 min in the new created timer
@yakupbaser @ToonvanStrijp I have no idea why your task isn't running I have tested my example app with galaxy 8 and enabled doze mode and standby mode with period of 20 minutes and it executed every time
Can you try to run the example app and see if the task not executing there too? Maybe somthing else in your app is breaking it? try to print the current time as the first line of code in the task method and see if it is printing if it is then the task is running as it should
btw use the latest update
I'm using the startPeriodicTask which works well, but it doesn't always run on the given interval.
I'm setting it up as followed:
Then my
periodicTaskFun
: