(Difference between revisions)

Listing installed applications in Symbian Web Runtime

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Fix links)
Line 1: Line 1:
{{ArticleMetaData <!-- v1.2 -->
{{ArticleMetaData <!-- v1.2 -->
|sourcecode= [[Media:WRTStub CS001160.zip]] [[Media:CS001160 Listing installed applications.diff.zip]]  
|sourcecode= [[Media:WRTStub CS001160.zip]] [[Media:CS001160 Listing installed applications.diff.zip]]
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|devices= Nokia 5800 XpressMusic
|devices= Nokia 5800 XpressMusic

Revision as of 05:24, 13 July 2012

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
Keywords: device.getServiceObject(), Service.AppManager
Created: tapla (23 Oct 2008)
Last edited: hamishwillee (13 Jul 2012)



This code snippet demonstrates how to use the AppManager Service API to discover the applications that are installed on the device.

Source: widget.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="script.js" />
<title>WRT Application</title>
<div id="bodyContent" class="bodyContent">

Source: script.js

var serviceObj = null;
window.onload = init;
// Initializes the widget
function init() {
// Obtain the AppManager service object
try {
serviceObj = device.getServiceObject("Service.AppManager",
} catch (ex) {
alert("Service object cannot be found.");
// We are interested in applications, so let's define the criteria
// respectively
var criteria = new Object();
criteria.Type = "Application";
// Obtain the list of installed applications
var result = serviceObj.IAppManager.GetList(criteria);
var appList = createAppList(result.ReturnValue);
// Creates the list of installed applications
function createAppList(iterator) {
var list = new Array();
try {
var item;
while ((item = iterator.getNext()) != undefined) {
var txt = "";
txt += item.Caption + " (";
txt += item.Uid + ")";
} catch (ex) {
return list;
// Displays a list on the screen
function displayList(list) {
var listElement = document.createElement("ol");
for (var i = 0; i < list.length; i++) {
var listItemElement = document.createElement("li");
var textElement = document.createTextNode(list[i]);
var bodyContentElement = document.getElementById("bodyContent");


The example displays an alphabetically ordered list of installed applications and their UIDs on an HTML page.

Supplementary material

  • You can test the application listing features in action in a simple, executable application into which this code snippet has been patched. The application is available for download at: Media:WRTStub CS001160.zip
  • You can examine all the changes that are required to implement the above mentioned features in an application. The changes are provided in unified diff and color-coded diff formats: Media:CS001160 Listing installed applications.diff.zip
  • For general information on applying the patch, see Using Diffs.
  • For unpatched stub applications, see Example stub.
76 page views in the last 30 days.