tags:

views:

138

answers:

1

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?

+2  A: 

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!!! =D

Here is the concept code. First on the VideoCanvas (screen for drawing video) I define the TimerTask:

private class WakeTask extends TimerTask
{
   public void run()
   {
      display.flashBacklight(100);
   }
}

Next in the VideoCanvas constructor I start the timer and pass it the timeout, for example 10 seconds... and thats it:

***

timer = new Timer();
timer.schedule(new WakeTask(), 0, 10000);

***

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.

Cipi