Find application mode, is it idle or not, in Java ME

535 views Asked by At

I want to send stored RMS data using an HTTP connection when the application is in idle mode.

So if the user is not doing anything with the application at that time, my thread will invoke and send RMS data to server.

For this requirement, how do I how find out if the application in active mode or idle mode?

2

There are 2 answers

4
Michael Donohue On BEST ANSWER

You could wait for the backlight to go off, if that's enough of an indication of whether the application is active.

Implement the SystemListener2 interface, there's a method backlightStateChange() that will be invoked after the object is registered with Application.addSystemListener

1
AlexR On

I do not see any smarter solution than using Displayable.setCommandListener(CommandListener l).

The command listener should use Timer. When a certain timeout (let's say 60 seconds) is expired, the timer task should run and trigger sending your data. I think that if you have access to the midlet's code, this solution is not so bad.