(Difference between revisions)

Retrieving current orientation of a device in WRT

From Nokia Developer Wiki
Jump to: navigation, search
kiran10182 (Talk | contribs)
(New page: __NOTOC__ __NOEDITSECTION__ {{CodeSnippet |id= |platform=S60 5th Edition |devices=Nokia 5800 XpressMusic |category=Web Runtime (WRT) |subcategory=System information |creationdate=December ...)
hamishwillee (Talk | contribs)
m (Automated change of category from Web Runtime (WRT) to Symbian Web Runtime)
Line 83: Line 83:
[[Category:Web Runtime (WRT)]][[Category:Code Examples]][[Category:How To]][[Category:S60 5th Edition]]
[[Category:Symbian Web Runtime]][[Category:Code Examples]][[Category:How To]][[Category:S60 5th Edition]]

Revision as of 02:55, 13 April 2011

Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
S60 5th Edition
Keywords: device.getServiceObject(), Service.SysInfo, Service.SysInfo.GetInfo()
Created: (25 Dec 2008)
Last edited: hamishwillee (13 Apr 2011)


This code snippet demonstrates how to obtain the Display Orientation of a device by using the SystemInfo Service API of the Web Runtime (WRT) 1.1.

Note: The SystemInfo Service API for WRT 1.1 is only available from S60 5th Edition onwards.

Source file: index.html

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="basic.js"></script>
<script type="text/javascript" src="WRTKit/WRTKit.js"></script>
<style type="text/css">
@import url("basic.css");
<body onload="init()">

Source file: basic.js

var systemServiceObj = null;
// Called from the onload event handler to initialize the widget.
function init()
systemServiceObj = device.getServiceObject("Service.SysInfo", "ISysInfo");
catch (ex)
alert("System Service object cannot be found.");
// Display Information
function getDisplayOrientation()
// Initialize the criteria for the service object and obtain the
// information
var criteria = new Object();
criteria.Entity = "Display";
criteria.Key = "DisplayOrientation";
try {
var result = systemServiceObj.ISysInfo.GetInfo(criteria);
catch (ex)
alert("Current Display Orientation: " + result.ReturnValue.Status);


  • Display Orientation of a device will be displayed on the screen in the range of 0 - 3.

Supplementary material

50 page views in the last 30 days.