I have a Listener class which implements ViewListener (contains two methods, open, close, which will fire when any monitored mailbox’s email is open/closed). So this is called from a class App extending UiApplication, and when i read a email, the open method is fired, i would like to call my original (App class) with a specific Screen (sending a message to app would be good enough). Currently i have it so that App have a static variable that stores the instance of app that’s running on the device. I used that to call a method to change screen, but it doesn’t actually bring it up. app.requestForeground() doesn’t seem to work either.
Any ideas?
Thanks a lot!
Have you tried using ApplicationManager to handle this? If you have a background system process listening for events, it may be possible that your GUI process isn’t even running (i.e. if you did a
System.exit(0)rather than backgrounding it). Here’s a snippet of code you can use to look for the GUI process (based on its app descriptor) and either bring it to the foreground (if it’s running) or launch it (if it’s not):To get the app descriptor for your GUI entry point, use the following methodology:
CodeModuleManager.getModuleHandleForClass(MyApp.class)CodeModuleManager.getApplicationDescriptors(handle)