Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
gibli
Posts: 44
Registered: ‎03-10-2009
My Device: Not Specified
Accepted Solution

activate/deactivate behaviour for system modules

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


Developer
jobincantony
Posts: 26
Registered: ‎08-04-2008
My Device: Not Specified

Re: activate/deactivate behaviour for system modules

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. :smileysad:

Developer
gibli
Posts: 44
Registered: ‎03-10-2009
My Device: Not Specified

Re: activate/deactivate behaviour for system modules

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

}

}

 


 

Developer
jobincantony
Posts: 26
Registered: ‎08-04-2008
My Device: Not Specified

Re: activate/deactivate behaviour for system modules

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/message?board.id=java_dev&message.id=22727#M22727

 

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.