For running a MIDlet in the background check the MIDP "Push Registry". It allows you to set a timer that periodically wakes up your MIDlet.
As for the emulator question: Not all phone manufacturers provide emulators. Not sure about the situation with the Wing.
Evangelist, Java Mobile & Embedded Community
Sun Microsystems, Germany
Well, I finally got some midlets to build and run on my wing using sunâ€™s netbeans system.
I never did find an emulator for the wing. That would sure make things easier.
But Iâ€™m just developing basic stuff on the high level interface, and that seems to be working.
The question I have now is, Iâ€™m trying to develop a background process that will always run on my wing, that will check a web site status every 5 minutes or so.
The current MIDlet Iâ€™ve developed works great until you try to switch out of java and go back to normal phone mode. All the java MIDlet stuff suspends and doesnâ€™t run till you reactivate it.
I hope I can find a way to get a java MIDlet to run in the background!?
Maybe I can somehow escape the MIDlet environment and run raw java?
Any other posobilities?
According to the MIDP2 specification, there may be another way to put a MIDlet into the "background". You may pass null to Display.setCurrent(). According to the spec;
"The application may pass null as the argument to setCurrent(). This does not have the effect of setting the current Displayable to null; instead, the current Displayable remains unchanged. However, the application management software may interpret this call as a request from the application that it is requesting to be placed into the background."
So, depending on the device, this may or may not work. I am assuming that when the spec talks about placing a MIDlet in the background, it means to say that no displayable is set - in affect the MIDlet has no ownership of the device's screen.
You could use this along with a thread in a waiting state, perhaps waiting for 5 minutes or so at a time, and on each run polling your server. Under certian conditions the thread could use Display.setCurrent() to once again display a Displayable.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.