6.2.1 GetList

GetList is used to retrieve information about user installed packages, all applications, and handler applications. It takes a set of input parameters that define Type and Filter to retrieve the required information. It is available only in synchronous mode.

The following is an example for using GetList:

appmanager_info = appmanager_handle.call('GetList', {'Type': u'Application'})

The following table summarizes the specification of GetList:

Interface IAppManager
Description Retrieves information about user installed packages or handler applications based on document path or MIME type.
Response Model Synchronous
Pre-condition Valid instance of IAppManager interface is instantiated.
Post-condition Nil

Input Parameters

Input parameters specify the Type of package or application to retrieve, and the Filter for the retrieved information. Input parameter has properties called Type and Filter.

Table 6.1: Input parameters for Getlist
Name Type Range Description
Type unicode string UserInstalledPackage, Application Performs service based on the following content types. This field is mandatory:

For Application content type, this API returns all the application present in the device, whether it is user installed or pre-installed.

For UserInstalledPackage content type, this API returns all user installed packages. This package contains either the application and the supporting DLL, or only the DLLs.

[Filter] map Key: DocumentPath or MimeType
Value: unicode string
This Filter Criteria is applicable when the Type is Application. It specifies the Document path or MIME type of the application. For example, document path: C:>\\data\\abcd.txt and MIME type: image/jpeg. You can use the filter criteria to find out the Handler application. If both DocumentPath and MimeType are present in the Filter map then, DocumentPath gets preference over MimeType.


Output Parameters

Output parameters contain the requested information. They also contain ErrorCode, and ErrorMessage if the operation fails.

Table 6.2: Output parameters for GetList
Name Type Range (Type: string) Description
ErrorCode int NA Service specific error code on failure of the operation.
ErrorMessage string NA Error description in Engineering English.
ReturnValue Iterable items InstalledPackage:
PackageName
Version
UID
Vendor
Drive
Application:
UID
Path
Caption
ShortCaption
An Installed package contains the metadata field and value (for example: name, version, and UID) of the package in the form of a map. Installed package map contains the UID of package (In S60, it is UID of the .sisx file).

In case of Application, the API returns the UID, path, and caption of the application. The API returns the appropriate error code if the application does not match the given criteria. For example, if the Mime type given for one SDK or Device is not valid for another, it returns an error code.


Errors

The following table lists the error codes and their values:

Table 6.3: Error codes
Error code value Description
0 Success
1002 Bad argument type
1004 Service not supported
1012 Item not found


Error Messages

The following table lists the error messages and their description:


Table 6.4: Error messages
Error messages Description
AppManager:GetList:Type Missing Indicates missing of a content type or a mismatch in the datatype of the given content type.
AppManager:GetList:Filter type mismatch Indicates a mismatch in the datatype of the given filter.
AppManger:GetList:Asynchronous version of API is not supported Indicates that the asynchronous version of unsupported GetList is called.


Example

The following sample code illustrates how to get the list of applications on S60 device:

import scriptext

# Load the desired SAPI
appmanager_handle = scriptext.load('Service.AppManager', 'IAppManager')
try:
   f = open('c:\\data.txt', 'a+')
   app_info = []
   appmanager_info = appmanager_handle.call('GetList', {'Type': u'Application'})
   for item in appmanager_info:
       app_info.append(item['UID'])
       app_info.append(item['Caption'])
       print item['UID']
       print item['Path']
       print item['Caption']
       print item['ShortCaption']
   f.write(str(app_info))
except scriptext.ScriptextError, err:
   print "Error getting the list of Installed Application: ", err

See About this document... for information on suggesting changes.