03-19-2009 02:37 AM
I want to build a module (extending Application) that will have no UI.
As a system + autostart module, will the activate/deactivate methods ever be called ?
Thanks
G
Solved! Go to Solution.
03-19-2009 04:41 AM
No.
By default, the system invokes activate() method when it brings the application to the foreground.
You are extending Application class and using the option System module, the application is working as a background application. So activate/ deactivate will not be invoked. ![]()
03-19-2009 04:56 AM
Thanks @jobincantony,
Which leads me to think that the class Application is not well designed since it is mixing concerns which are UI related.
I've not seen any samples of a System background module. Do you know of any that will help my understanding ?
From what I can guess, the Application subclass would look something like this:
public class BgApp extends Application implements Runnable
{
public static void main( String[] args )
{
BgApp theApp = new BgApp( args );
theApp.enterEventDispatcher(); // not sure if I need to call this
}
public BgApp( String[] args )
{
EventLogger.register( Constants.GUI, "bgapp", EventLogger.VIEWER_STRING );
new Thread( this ).start();
}
public void run()
{
// do stuff in the background
}
}
03-19-2009 06:50 AM
Could you please update your exact requirement.
1. Is this background module is a part of another application?
2. Is this "BgApp" is a simple background application ( no dependencies) which intended to monitor or do some background activities and Auto-start upon device start-up ?
No need to implement this Runnable, if you select SystemModule and Auto-startup option unless you have specific requirement to run your code in a seperate thread.
By the way if you select "Auto-startup " option will not make the application auto-start in SOFT reset. check
http://supportforums.blackberry.com/rim/board/mess
If your application is not exiting completely you can implement the SystemListener inerface and override powerUp() method to detect the SOFT reset and do your start-up activity.