Rince Thomas
Rince Thomas

Reputation: 4158

Blackberry service and ui application running

My code is -

 if ( args != null && args.length > 0 && args[0].equals("background1") ){
        // Keep this instance around for rendering
        // Notification dialogs.
         // Start a new app instance for GUI operations.     
        BackgroundApplication backApp=new BackgroundApplication();
        backApp.setupBackgroundApplication();   
       // backApp.enterEventDispatcher();
} 
    else {       
         theApp = new EntryPointForApplication();
         theApp.enterEventDispatcher();    

   }   

I want to run a background service (in auto start up) and an ui application. When i click the application background1, then its working. The background service is not running. I want to run the background service. How to run this ?. I am getting the error-

Detail formatter error: java.util.Arrays cannot be resolved to a type

Upvotes: 0

Views: 616

Answers (1)

BBdev
BBdev

Reputation: 4942

You can achieve this by using Alternate entry point in your application ...

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

  • Double click on BlackBerry_App_Descriptor.xml within your project.

  • Check off System Module and Do not display the application icon on the BlackBerry home screen.

  • Click on the Alternate Entry Point tab.

  • Click the Add button.

  • Enter a title for the entry point and click OK.

  • Specify the application argument that would launch the application using this alternate entry point (for example: background1).

Make a class Wich will extend Application rather than UiApplication and check the main method like this ...

public static void main(String[] args) {

     if(args.length>0&&"background1".equals(args[0])){
         //Start your Background Process here 


        }

     else{
        //Start your Gui application here 
     }
}

Upvotes: 1

Related Questions