We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
问下用thread能唤醒屏幕吗?
var hour1 = 08, min1 = 20, second1 = 30; run(); //实时显示脚本运行时长,并对返回的时长与设定的时长进行判断 function run() { //声明运行函数 threads.shutDownAll(); threads.start(function () { while (true) { console.show(); console.log(new Date().getSeconds()); if ((new Date().getHours() * 1 == hour1 && new Date().getMinutes() * 1 == min1 ) { if (!device.isScreenOn()) { device.wakeUp(); sleep(1000); swipe(500, 0, 500, 1900, 2000); gotoDaKa(); back(); sleep(2000); run(); } else { gotoDaKa(); back(); sleep(2000); run(); } } sleep(1000); } }); }
ps:在不息屏的情况下执行没问题,但是在息屏threads好像没执行了,问下怎么解决?
The text was updated successfully, but these errors were encountered:
最好不要在息屏时循环sleep 不管是主线程还是子线程,息屏时都会受到手机电池管理策略的影响,Update频率会降低,出现假死的情况 所以才要依靠外部的程序发出一个通知来点亮屏幕
Sorry, something went wrong.
你可以在循环里加个打印测试一下,息屏之后,打印的间隔会越来越长
No branches or pull requests
问下用thread能唤醒屏幕吗?
var hour1 = 08, min1 = 20, second1 = 30;
run();
//实时显示脚本运行时长,并对返回的时长与设定的时长进行判断
function run() { //声明运行函数
threads.shutDownAll();
threads.start(function () {
while (true) {
console.show();
console.log(new Date().getSeconds());
if ((new Date().getHours() * 1 == hour1 && new Date().getMinutes() * 1 == min1 ) {
if (!device.isScreenOn()) {
device.wakeUp();
sleep(1000);
swipe(500, 0, 500, 1900, 2000);
gotoDaKa();
back();
sleep(2000);
run();
}
else {
gotoDaKa();
back();
sleep(2000);
run();
}
}
sleep(1000);
}
});
}
ps:在不息屏的情况下执行没问题,但是在息屏threads好像没执行了,问下怎么解决?
The text was updated successfully, but these errors were encountered: