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
New Developer
Posts: 28
Registered: ‎07-21-2008
My Device: Not Specified

application with alternate entry point

There was a article in the knowledge base regarding "Creating an application with an alternate entry point".  In the example, the application will start on device boot and then run in the background and will only foreground itself when the icon on the ribbon is clicked on (some arguments will be passed to main(), and that's how the application differentiate between a (auto start & run in background) and (foreground itself)). 

 

here is my code snippet:

 

     public static void main(String[] args)
    {
        if(args != null && args.length > 0 && args[0].endsWith("gui"))
        {
            //Entered by selecting the application icon on the ribbon
            //Start the GUI
            Application app = new Application();
            app.enterEventDispatcher();
        }
        else
        {
            //Entered through the alternate application entry point
            //Enable PIMListener on startup if the setup has completed.

             Logger.log(DEBUG, "The set up has completed therefore we can start the background listener");
             BackgroundListener.waitForSingleton();

        }
    }

 

 

 

My question is that, is there a way for me to pass an arguement to the app when i am using ApplicationManager.runApplication(ApplicationDescriptor, true)?  I make this call in my BackgroundListener.  If i just use this method, the application will see it as the same as a auto start on boot since no arguement is pass to it.

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

Re: application with alternate entry point

We pass arguments in the autostartup case such as

 if ( args.length > 0 && args[0].equals("autostartup"))

 so we can single out the auto start case. Everything else is then a launch from the ribbon.

BlackBerry Development Advisor
Posts: 14,967
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: application with alternate entry point

Yes, you can specify the application arguments within the ApplicationDescriptor.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker