使用code禁用休眠模式黑莓 [英] Disabling Sleep Mode in Blackberry using Code
问题描述
如何从将在黑莓使用J2ME睡眠模式prevent应用?
How to prevent the app from going to sleep mode in blackberry using J2ME?
我已经看到了这个建议做一<一href=\"http://supportforums.blackberry.com/t5/Java-Development/$p$pvent-BlackBerry-From-Going-Into-Sleep-Mode/td-p/234912\"相对=nofollow>重点注射也阅读了本<一个href=\"https://bdsc.webapps.blackberry.com/native/beta/documentation/com.qnx.doc.native_sdk.devguide/com.qnx.doc.native_sdk.devguide/topic/lifecycle_disable_automatic_standby.html\"相对=nofollow>文档从原生SDK 的。
I have seen this suggestion to do a Key Injection also read this docs from Native SDK.
但我不知道第二个方法是否适用于J2ME。
But I am not sure whether the second method works with J2ME.
我怎么可以和J2ME做到这一点efficently黑莓?
How can I do this efficently in blackberry with J2ME?
推荐答案
有关禁用休眠模式,可以读<一个href=\"http://supportforums.blackberry.com/t5/Java-Development/$p$pvent-the-Lock-screen-from-interrupting-your-application/ta-p/445094\"相对=nofollow>这个文章。
About disabling sleep mode, you can read this article.
要在黑莓解决这个问题,我用code如下:
To solve this problem in blackberry I used code below:
import net.rim.device.api.system.Backlight;
import net.rim.device.api.util.DateTimeUtilities;
int MAX_BACKLIGHT_TIMEOUT_SECS = 255;
....
Backlight.setTimeout(MAX_BACKLIGHT_TIMEOUT_SECS);
Timer timer_ = new Timer();
timer_.scheduleAtFixedRate(new TimerTask()
{
public void run()
{
Backlight.enable(true);
}
},
(MAX_BACKLIGHT_TIMEOUT_SECS - 1) * DateTimeUtilities.ONESECOND,
(MAX_BACKLIGHT_TIMEOUT_SECS - 1) * DateTimeUtilities.ONESECOND);
这篇关于使用code禁用休眠模式黑莓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!