在 JavaME 中不要让显示器进入待机状态
我正在将视频流传输到我的 MIDLET。播放时,20 秒后(取决于系统设置)手机显示屏将进入待机模式。
如何防止这种情况发生,以便我可以观看视频 5 分钟,而无需点击某些东西来唤醒显示屏?
Im streaming video to my MIDLET. And while it is playing it, after 20 seconds (depends on a system setting) display on the phone goes to stand-by mode.
How can I prevent this so I can watch the video for 5 minutes for example without having to tap something to wakeup the display?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,我明白了!但这是一个小技巧,而不是真正的“不要进入待机”功能......尽管如此,它仍然可以完美!!!! =D
好的,所以我们的想法是定义显示器需要唤醒的超时时间。我让用户在“设置”屏幕中定义它,然后将其写入 RMS,以便稍后阅读...
接下来,我定义调用 getDisplay().flashBacklight(100); 的 TimerTask > 每当定义的超时到期时方法。而且,这就像一个魅力! =D
这是概念代码。首先在 VideoCanvas(用于绘制视频的屏幕)上定义 TimerTask:
接下来在 VideoCanvas 构造函数中,我启动计时器并为其传递超时,例如 10 秒......就是这样:
所以如果显示器在之后进入待机状态15 秒,计时器每 10 秒运行一次,它永远不会进入待机状态,并且会保持唤醒状态,直到您停止计时器。如果它在 5 秒内进入待机状态,定时器每次运行时都会将其唤醒,就像您点击手机上的某个东西来唤醒它一样。 =)))
Yaaaay... =)))
PS 在 NOKIA N96 上测试。
Yeeeey I figured it out!!! But its a little hack and not the actual "Dont-Go-To-Stand-By" functionality... nevertheless it works PERFECT!!!! =D
Ok so the idea is to define the timeout that the display needs to be woken up. I let the user define this in the "Settings" screen and I write that in RMS so I can read it later...
Next, I define the TimerTask that calls
getDisplay().flashBacklight(100);
method every time that the defined timeout expires. And, this works like a charm!!! =DHere is the concept code. First on the VideoCanvas (screen for drawing video) I define the TimerTask:
Next in the VideoCanvas constructor I start the timer and pass it the timeout, for example 10 seconds... and thats it:
So if the display goes to stand by after 15 seconds, and the timer runs every 10 seconds, it will never go to stand by, and will stay waken until you stop the timer. And if it goes to stand by in 5 seconds, timer will wake it up every time it runs just like you do when you tap something on the phone to wake it up. =)))
Yaaaay... =)))
P.S. Tested on NOKIA N96.