Disabling Sleep Mode in Blackberry using Code

2019-07-18 20:51发布

How to prevent the app from going to sleep mode in blackberry using J2ME?

I have seen this suggestion to do a Key Injection also read this docs from Native SDK.

But I am not sure whether the second method works with J2ME.

How can I do this efficently in blackberry with J2ME?

2条回答
贼婆χ
2楼-- · 2019-07-18 21:34

About disabling sleep mode, you can read this article.

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);
查看更多
Viruses.
3楼-- · 2019-07-18 21:43

I think this may be achieved ... you can send keyBoard event to the device. For more information see this Prevent BlackBerry From Going Into Sleep Mode.

查看更多
登录 后发表回答