×
Namespaces

Variants
Actions
(Difference between revisions)

MIME type handling in Symbian Web Runtime

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot change of template (Template:CodeSnippet) - now using Template:ArticleMetaData)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update)
Line 1: Line 1:
__NOTOC__
+
{{ArticleMetaData <!-- v1.2 -->
__NOEDITSECTION__
+
|sourcecode= [[Media:MimeTypeHandling.zip]] [[Media:MimeTypeHandling.diff.zip]]  
{{KBCS}}
+
{{ArticleMetaData
+
|id=CS001406
+
|platform=S60 5th Edition
+
|devices=Nokia 5800 XpressMusic
+
|category=Web Runtime (WRT)
+
|subcategory=Files/Data
+
|creationdate=June 8, 2009
+
|keywords=device.getServiceObject(),Service.IAppManager.LaunchDoc(),
+
menu.setRightSoftkeyLabel(),widget.setNavigationEnabled(),
+
Service.IDataSource.GetList()
+
 
+
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.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]]) -->
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
+
|devices= Nokia 5800 XpressMusic
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
+
|platform= S60 5th Edition
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices. -->)
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|author=[[User:Ivruban]]
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= device.getServiceObject(),Service.IAppManager.LaunchDoc(),
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20090226
 +
|author= [[User:Ivruban]]
 +
<!-- The following are not in current metadata -->
 +
|subcategory= Files/Data
 +
|id= CS001406
 
}}
 
}}
  
Line 78: Line 81:
 
==See also==
 
==See also==
  
* [[CS001245 - Loading images in WRT]]
+
* [[Loading images in Symbian Web Runtime]]
  
 
==Supplementary material==
 
==Supplementary material==
Line 89: Line 92:
 
* For unpatched stub applications, see [[Example stub]].
 
* For unpatched stub applications, see [[Example stub]].
  
[[Category:Symbian Web Runtime]][[Category:Code Examples]][[Category:Files/Data]][[Category:S60 5th Edition]][[Category:Code Snippet]]
+
[[Category:Symbian Web Runtime]][[Category:Code Examples]][[Category:Files/Data]][[Category:S60 5th Edition (initial release)]][[Category:Code Snippet]]

Revision as of 09:11, 10 May 2012

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 5th Edition
S60 5th Edition
Article
Keywords: device.getServiceObject(),Service.IAppManager.LaunchDoc(),
Created: ivruban (26 Feb 2009)
Last edited: hamishwillee (10 May 2012)

Contents

Overview

This code snippet demonstrates how to launch an application based on a given document using the AppManager Platform Service for Web Runtime, introduced in S60 5th Edition. Image files were chosen to present the MIME type handling in WRT.

Source file: Relevant HTML components

<select size = "5" id = "imageList" onclick = "show();">
<option></option>
</select>

Source

/**
* Shows the selected image.
*/

function show() {
var so = null;
 
try {
//Getting service object for application management.
var so = device.getServiceObject("Service.AppManager", "IAppManager");
} catch (ex) {
alert("Exception in getting application service object: " + ex);
return;
}
 
var imageList = document.getElementById("imageList");
for (var i = 0; i < imageList.options.length; i++) {
if (imageList.options[i].selected) {
var criteria = new Object();
criteria.Document = new Object();
//Setting the path to file that must be opened in a standalone
//application
criteria.Document.DocumentPath = imageList.options[i].value;
//Opening the file in standalone application
try {
var res = so.IAppManager.LaunchDoc(criteria);
if (res.ErrorCode != 0){
alert(res.ErrorCode + ' ; ' + res.ErrorMessage);
}
} catch (ex){
alert("Exception in launching document: " + ex);
}
}
}
}

Postconditions

The image selected from the list is displayed in a standalone application.

See also

Supplementary material

This code snippet is part of the stub concept, which means that it has been patched on top of a template application in order to be more useful to developers. The version of the WRT stub application used as a template in this snippet is v1.1.

  • The patched, executable application that can be used to test the features described in this snippet is available for download at Media:MimeTypeHandling.zip.
  • You can view all the changes that are required to implement the above-mentioned features. The changes are provided in unified diff and colour-coded diff (HTML) formats in Media:MimeTypeHandling.diff.zip.
  • For general information on applying the patch, see Using Diffs.
  • For unpatched stub applications, see Example stub.
75 page views in the last 30 days.
×