Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timer always triggered at 60000 [ms] #5

Open
kripper opened this issue Jun 17, 2018 · 5 comments
Open

Timer always triggered at 60000 [ms] #5

kripper opened this issue Jun 17, 2018 · 5 comments

Comments

@kripper
Copy link

kripper commented Jun 17, 2018

I'm testing this plugin on a Android 5.1.1 (Lenovo A6020I36) and it triggers the event always after aprox. 60.000 [ms] (actually it triggers erratically after: 59.978, 92.845, 134.366, 12.776, 59.998, ... [ms]).

This is the code:

var settings = {
	timerInterval: 5000,
	startOnBoot: true,
	stopOnTerminate: false,
}

BackgroundTimer.onTimerEvent(eventCallback);
BackgroundTimer.start(successCallback, errorCallback, settings);
@dukhanov
Copy link
Owner

Hi, it looks like the Android OS limitations
Have not seen it before

@flight9
Copy link

flight9 commented Jul 4, 2018

I also found it's not accurate.
I set the timer like this:

var settings = {
    timerInterval: 24 * 60 * 60 * 1000, // 24 hr
    startOnBoot: true,
    stopOnTerminate: true,
    hours: 0,
    minutes: 30
  };

, found sometimes it has deviation more than 1 hr.
Then is there a way to fix this?

@beebase
Copy link

beebase commented Jul 25, 2018

I'm seeing the same thing with {timerInterval: 1000}
Every 60 seconds but something also randomly.
image

@hcker2000
Copy link

hcker2000 commented Feb 9, 2022

I too am getting this issue where the first trigger will happen at say 5 seconds and then every one after that is at 60 seconds.

Looks like android has allowed the phone to shift the time based on thinks like battery condition, etc..

AlarmManager Info

Looks like setExact would do whats needed

@kripper
Copy link
Author

kripper commented Feb 10, 2022

It seems that the app is moved to background by design to save battery and having a timer is not supported.
A solution would probably require to use some OS features or push notifications (for other use cases).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants