01-08-2010 09:28 PM
We have recently build an application that runs in the background using autostart. I works fine until we decided to add an interface to it. Since the application is already running, the debuger Says: Starting myApp, myApp is already running!
Is there anyway to tell the main to bring the application in foreground if it is running instaed of trying to re-launch it?
01-09-2010 08:12 AM
What you are doing works for me. I have an auto-start UiApplication, that pushes a Screen, but does a requestBackground() to stay in the Background (actually to be honest, I'm not sure the requesBbackground() is needed). Then the icon click just foregrounds it automatically. You have to be careful that you do not let this Application exit, so rather than pop the last screen, on close you just requestBackground(). This does not use an Alternate Entry. You will probably get people who will tell you to use Alternate Entry, you don't need to and it introduces complications with shared data.
The only trick with this is that your startup processing must what for a
before doing any Ui related stuff.
Can I suggest you test out this approach by creating a new and very simple UiApplication with just one screen. Create the start-up processing that waits for inStartup(), then pushes the screen and requestBackground(). Define an icon for it. Then start up the SImulator. On the Task Switch screen, you should see your application. Switching to it, or clicking on your icon should bring up your Screen.
06-30-2010 01:30 PM
Peter, I can't stress how important your message is. I've just changed the way my application works and I'm amazed - no more states inconsistencies in the GUI!
Using the alternative entry approach:
1) the GUI can be started at any point of the entire lifetime meaning you'll have to store everything you might need in the GUI, and load everything with accuracy.
2) Extremely difficult for users to completely exit your application and restart it manually, because your application is spread across 2 processes, one being an autostart system module (different entry point from Application icon).