问题
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?
回答1:
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.
回答2:
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);
来源:https://stackoverflow.com/questions/9093706/disabling-sleep-mode-in-blackberry-using-code