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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
New Developer
Chouman82
Posts: 28
Registered: ‎07-21-2008

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.

Please use plain text.
Developer
ercollin
Posts: 26
Registered: ‎08-14-2008

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.

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

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.
Found a bug? Report it using the Issue Tracker
Please use plain text.