Launching a native application from a MIDlet

Note: Only manufacturer and operator domain MIDlets can start native applications.

In Symbian (JRT 2.1 onwards), native applications are launched with the platformRequest(nativeapp:) method. It identifies the application by its UID (application-uid) or the name of the executable (application-exe). In addition, you can specify a file or other content for the application to run. For example, you can specify the file name of the .jpg image to be viewed when starting ImageViewer application.

The actual command line arguments are entered with the application-args parameter. These depend on the application being launched. For example, Calendar recognizes the Today argument value, which returns the current day. The following example shows how to start a native application with command line arguments:

  • platformRequest("nativeapp:application-exe=MediaPlayer.exe;content=E:\Feelings.MP3;application-args=-ExampleArgument");

After the native application has been started, it can acquire the command line arguments in the following manner:

CApaCommandLine* commandLine;
User::LeaveIfError( CApaCommandLine::GetCommandLineFromProcessEnvironment(commandLine) );
// Get the value of _content_
TFullName documentName = commandLine->DocumentName();
// Get the value of _application-args_
TPtrC8 args = commandLine->TailEnd();

In Series 40, native applications are launched with platformRequest(localapp:) method. The following opens the Photos folder in Gallery.

  • platformRequest("localapp://gallery/show?folder=C:/predefgallery/predefphotos");