How can I run a background service application and UIApplication simultaneously

I want to run a background service application and UIApplication at the same time.

Is it possible to create both in one project and create a separate separate project.

Actually, I got confused about how to call or start background maintenance in the event flow.

+1
source share
2 answers

Here's how you can configure an alternative entry point for your application:

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

After creating the project for the source application, create an alternative entry point to launch the application user interface.

1- Double-click on BlackBerry_App_Descriptor.xml in your project.
2- Disable the system module and do not display the application icon on the BlackBerry main 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- Indicate the argument of the application that launched the application using this alternative entry point (for example: gui).
7- Go to the "General Steps" section.
8- Change the main () method of the source project as follows:

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



B- Using BlackBerry JDE

After creating projects for the source application, you will need to create another project for the entry point to the interface. Assuming that the running thread exists in the same project as the source application, follow these steps:

1- Right-click the node project and select Properties.
2- In the "Properties" window, select the "Application" tab.
3- Make sure that the following options are checked: Autostart at startup and System module (for registering a stream in the system).
4 Create another project in the same folder as the source project. Right-click the new node project and select Properties.
5- Select the "Application" tab and select "Alternative entry point for the CLDC application" in the "Project Type" drop-down list. As shown in the attached file, select the name of the source project (for example, trafficreporter) from the alternative entry point for the drop-down list. Also specify the arguments that will start the application using this alternative entry point (for example: gui). Go to the "General steps" section.
6- Change the main () method of the source project as follows:

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

http://supportforums.blackberry.com/t5/Java-Development/Background-thread-for-push-notifications/td-p/563071

Blackberry dev forums are full of threads and sample code to execute this.

Personally, I use an alternative entry point method, I launch a background application like UiApplication autostart (without an icon), which never pushes MainScreen, but uses its own send stream to trigger a dialog or similar notifications, and then when the actual house icon is clicked / clicked, I am launching a Ui entry point to play with a user.

+1
source

Source: https://habr.com/ru/post/1434401/


All Articles