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

setInterval 和 APP 自带的定时任务在熄屏情况下的不同 #318

Open
yahuian opened this issue Feb 2, 2025 · 1 comment
Open

Comments

@yahuian
Copy link

yahuian commented Feb 2, 2025

背景

经过多次测试发现使用 setInterval 实现的定时任务,在熄屏情况下,定时器不会运行

但是使用 APP 的定时任务-广播触发任务-每分钟一次,在熄屏情况下,依旧会运行

问题

  1. 这两者的实现原理有什么区别?
  2. 广播触发任务-每分钟一次 这个选项是否可以自定义触发时间

感谢🌹

@yahuian
Copy link
Author

yahuian commented Feb 3, 2025

又发现一个问题,通过广播触发任务-每分钟一次设置的定时任务,在其运行过程中

如果手动点亮屏幕,会立即再触发一次脚本,如下图 10:20 分运行了两次

Image

如果多次手动点亮屏幕,从日志来看,现象是手动点亮一次屏幕,任务几乎同时会被触发多次,然后极大概率软件会奔溃

Image

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

1 participant