Developers

Local Navigation

Home > Developers > Developers Knowledge Base

Back

How To - Launch a third-party application from another third-party application

Last Updated: 16 September 2008
Article Number: DB-00455

Summary

This article applies to the following:

  • BlackBerry® smartphones based on Java® technology

Procedure

On the BlackBerry smartphone, you can launch a third-party application from another third-party application. The following code samples demonstrate how this can be done.

Launching a Java application from another Java application

These examples demonstrate how to launch a Java application from another Java application.

Example 1

int modHandle = CodeModuleManager.getModuleHandle("MyApplication");
ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);
ApplicationManager.getApplicationManager().runApplication(apDes[0]);

Example 2

ApplicationManager.getApplicationManager().launch("yourCodFileName?param1&param2");

Launching a BlackBerry MDS Runtime Application

BlackBerry® Mobile Data System (BlackBerry MDS) Runtime 4.5.0 added the feature where a BlackBerry MDS Runtime application can be launched by a Java application. The next two examples demonstrate how this can be done.

Example 1

ApplicationDescriptor[] appDescriptors =
    CodeModuleManager.getApplicationDescriptors(
         CodeModuleManager.getModuleHandle("yourMDSRuntimeCodFileName"));
ApplicationDescriptor appDescriptor = new ApplicationDescriptor(
    appDescriptors[0], new String[] {"param1", "param2", "param3", "param4"});
ApplicationManager.getApplicationManager().runApplication(appDescriptor);

Example 2

ApplicationManager.getApplicationManager().launch("yourCodFileName?param1&param2");

The cod file name can be seen within the JAR of the BlackBerry MDS Runtime Application or from the project's bin/debug folder after the project is built.

Launching a Java application from a BlackBerry MDS Runtime Application

BlackBerry MDS Runtime 4.5.0 and later also allows a BlackBerry MDS Runtime Application to launch a Java application. This is done using the System.exec method. The following examples show how to use this method.

//Opens a Java application named "lookup."
System.exec(APP_TYPE.JAVA, "lookup");

//Opens the application at the findBusiness entry point.
System.exec(APP_TYPE.JAVA, "lookup.findBusiness?");

//Opens the application at the findBusiness entry point, using the specified parameters.
System.exec(APP_TYPE.JAVA, "lookup.findBusiness?what=coffee&where=M4M"); var parameters = ["what=coffee","where=M4M"];

//Opens the application at the findBusiness entry point, using the specified parameters.
System.exec(APP_TYPE.JAVA, "lookup.findBusiness", parameters);

Note: An application can also schedule another application to be launched at a specific time. This can be done through the use of the ApplicationManager.scheduleApplication method.


Keywords

launch, ApplicationManager, run, start, schedule, invoke, System, exec, exec, MDS