Description:
The LaunchDoc method launches an application based
on a given document. This method automatically determines which application
to launch for the specified document.
The application can be launched as chained (embedded) or standalone. For more information about embedded and standalone applications, see section Accessing and launching installed applications.
This method can be called both synchronously and asynchronously.
Syntax:
For synchronous calls:
LaunchDoc(parameters:Object):Object
For asynchronous calls:
LaunchDoc(parameters:Object, callback:Object):Object
Arguments:
parameters:
This is an object that specifies which application to launch. For more information about the object properties and how to define them, see section Parameters for launching an application.
callback:
The callback argument is the name of the method
that is executed when an asynchronous LaunchDoc call
has status information to return. You must define this method separately.
Follow the instructions in section Defining the callback handler for an asynchronous method to
define the callback method.
This argument is used only with an asynchronous LaunchDoc call.
Return value:
If synchronous, the LaunchDoc method returns an
object that contains the name of the newly created document, if applicable,
an error code, and an error message.
|
Property |
Description |
Value |
|---|---|---|
|
|
This is a string that contains the name of the newly created document, if any. This property is optional. A new document is created only when both of the following are true:
A document name is never returned when |
|
|
|
This is a number that specifies a predefined error code. |
|
|
|
This is a text string that describes the error. |
If asynchronous, the LaunchDoc method returns an
object that contains the initial return value for the asynchronous call it
started (see the following table). The actual result information is returned
by the callback method
in the ReturnValue property of its result object. The
returned information is described in the preceding table.
Note: If Cancel is
called on an ongoing asynchronous request, LaunchDoc does
not return a notification when the launched application terminates.
|
Property |
Description |
Value |
|---|---|---|
|
|
This is a number used as an identification to match transactions started
with the asynchronous |
|
|
|
This is a number that specifies a predefined error code. |
|
|
|
This is a text string that describes the error. |
Example code:
The following sample code illustrates how to launch a document synchronously:
import com.nokia.lib.Service;
var appManager = new Service("Service.AppManager", "IAppManager");
var documentPath = {DocumentPath:"c:\\sample.swf"};
var inParams = {Document:documentPath};
var outParams = appManager.LaunchDoc(inParams);
var errorId = outParams.ErrorCode;// Contains the error code
The following sample code illustrates how to launch a document asynchronously:
import com.nokia.lib.Service;
var appManager = new Service("Service.AppManager", "IAppManager");
var documentPath = {DocumentPath:"c:\\sample.swf"};
var inParams = {Document:documentPath};
appManager.LaunchDoc(inParams, onDoclaunch);
function onDoclaunch(transactionID:Number, eventID:String, outParam:Object) {
var errorId = outParam.ErrorCode;}