10-05-2009 12:21 PM
I have a native BB app, my main class extends UiApplication. Is there a method we can override to know when the user has terminated the application? I need to do some cleanup when the app is done. I see deactive(), but I think that's just for when the app is pushed into the background, not terminated,
10-05-2009 01:24 PM
I am not aware of anything like this, though it makes some sense that something like this is possible.
How I do this is never code System.exit(n) in any application code, but instead have it in some shared code, say a myExit(int rc) method, which is also responsible for tidying everything up. If anything wants to 'exit', it has to call myExit. Works OK for me.
10-05-2009 01:41 PM
I've seen code samples with an onExit method, but I don't see it in the API. Deprecated/removed? Wrong API? Anybody know?
You might contrive to run the app in its own thread and do a join to know when the thread terminates, but that sound like overkill.
Since you're using UIApplication, you're probably using a Screen, so it might be enough for you to override the onClose method for the first Screen you push.
10-05-2009 02:21 PM