LaunchDoc is used to launch a document in standalone mode or embedded mode. It takes a set of input parameters that specifies the DocumentPath, MimeType, and options.
The following are the examples for using LaunchDoc:
Synchronous
appmanager_id = appmanager_handle.call('LaunchDoc',
{'Document': {'DocumentPath': u'c:\\data\\beak.jpg'}})
Asynchronous
appmanager_id = appmanager_handle.call('LaunchDoc',
{'Document': {'DocumentPath': u'c:\\data\\beak.jpg'}},
callback=launch_doc_callback)
where, launch_doc_callback is a user defined callback function.
The following table summarizes the specification of LaunchDoc:
| Interface | IAppManager |
| Description | Launches the application based on a given document. |
| Response Model | Synchronous and asynchronous |
| Pre-condition | Valid instance of IAppManager interface is instantiated. |
| Post-condition | Nil |
Input Parameters
Input parameter specifies the DocumentPath, MimeType, and mode options.
|
Launchdoc finds the Handler application internally, in the absence of MimeType. It launches the application based on the MIME type and returns the path of the new document, if the Document is absent from the input.
In Asynchronous mode the launching application receives a notification when the launched application dies. The notification is not received if this request is cancelled. Cancelling the request does not close the launched application.
Chained mode is applicable for UI based applications only.
Output Parameters
Output parameters contain ReturnValue. They also contain ErrorCode, and an ErrorMessage, if the operation fails.
|
Errors
The following table lists the error codes and their values:
|
Error Messages
The following table lists the error messages and their description:
|
Example
The following sample code illustrates how to launch an application on S60 device, in asynchronous mode:
import scriptext
import e32
lock = e32.Ao_lock()
# Callback function will be called when the requested service is complete
def launch_doc_callback(trans_id, event_id, input_params):
if trans_id != appmanager_id and event_id != scriptext.EventCompleted:
print "Error in servicing the request"
print "Error code is: " + str(input_params["ReturnValue"]["ErrorCode"])
if "ErrorMessage" in input_params["ReturnValue"]:
print "Error message is: " + input_params["ReturnValue"]["ErrorMessage"]
else:
print "Application Launched Successfully: "
lock.signal()
# Load appmanage service
appmanager_handle = scriptext.load('Service.AppManager', 'IAppManager')
# Make a request to query the required information in asynchronous mode
# Path dependent on the environment on which the application is run
appmanager_id = appmanager_handle.call('LaunchDoc', {'Document': {'DocumentPath': u'c:\\data\\beak.jpg'}}, callback=launch_doc_callback)
print "Waiting for the request to be processed!"
lock.wait()
print "Request complete!"
See About this document... for information on suggesting changes.