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

Set up an alternate entry point for an application

by Retired on ‎02-16-2010 10:53 AM - edited on ‎07-29-2010 11:35 AM by Retired (15,236 Views)



This article applies to the following:


  • BlackBerry® Java® Development Environment (JDE)
  • BlackBerry devices based on Java technology



Alternate Entry Points can be used to launch an application in different ways. This feature allows an application to be launched in the background when the BlackBerry device starts up to perform a background task (listen for incoming push messages, pre-process data, initialize network communications with a server host, etc.) as well as have an icon appear on the BlackBerry device home screen that displays the application UI.  Alternate entry points can also be used to create multiple icons that launch the application in different ways.


The following example demonstrates creating an application that auto starts when the BlackBerry device starts up and displays an icon on the home screen that the BlackBerry device user can use to click on to display the application UI.



Using the BlackBerry® Java® Plug-in for Eclipse®


After creating the project for the original application, create an alternate entry point to launch the application UI.


  1. Double click on BlackBerry_App_Descriptor.xml within your project.
  2. Check off System Module and Do not display the application icon on the BlackBerry home screen.
  3. Click on the Alternate Entry Point tab.
  4. Click the Add... button.
  5. Enter a title for the entry point and click OK.
  6. Specify the application argument that would launch the application using this alternate entry point (for example: gui).
  7. Proceed to the Common Steps section.


Using the BlackBerry JDE


After creating the projects for the original application, you will have to create another project for the UI entry point. Assuming that the thread to be run exists in the same project as the original application, follow these steps:


  1. Right-click the project node and select Properties.
  2. In the Properties window, select the Application tab.
  3. Verify the following options are checked: Auto-run on startup and System module (to register the thread with the system).
  4. Create another project under the same folder as the original project. Right-click the new project node and select Properties.
  5. Select the Application tab and select Alternate CLDC Application Entry Point from the Project type drop-down list. As shown in the attached file, select the name of the original project (for example, trafficreporter) from the Alternate entry point for drop-down list. Also specify the arguments that would launch the application using this alternate entry point (for example: gui).
  6. Proceed to the Common Steps section.

Common Steps

  1. Modify the main() method of the original project as follows:

    public static void main(String[] args) {
    if ( args != null && args.length > 0 && args[0].equals("gui") ){
    // code to initialize the app
    } else {
    // code to launch the background thread }


  3. Add your application icon file to the this new entry point application and make it the ribbon icon.

The entry point application now consists only of an application icon and a parameter to pass to the main() method of the main application. There is no source code associated with this project. The main application contains all of the source code, including the thread to be started automatically.


Now, whenever the BlackBerry device is started, this main() method will be executed without any arguments, and the background thread will start. When the application icon is clicked from the main ribbon, the main() method will be executed with the argument specified in the above code sample ("gui") and the application can pop a screen to the foreground.


Additional Information


by Developer
‎11-24-2011 01:36 PM - edited ‎11-24-2011 02:04 PM

The text of this article is mostly Cut/Paste from the previous one: How To - Setup an alternate entry point for my application

That is why some phrases are so confusing, like "..no source code associated with this project" (?!)

This is true only for JDE version and not right for the Eclipse one because there is only one(!)  project, and so on.

Next, article (again) failed to mention that this Alternate Entry Point technique in fact creates second instance of the application.

So I would also add couple words (or reference) about communication between these two instances.

Users Online
Currently online: 13 members 799 guests
Please welcome our newest community members: