How to load System Info Service Object in WRT - A generic approach
Article Metadata
Compatibility
Platform(s): S60 3rd Edition
Article
Keywords: System Information Service (SysInfo)
Created: vasant21
(January, 4th, 2010)
Last edited: hamishwillee
(24 Jun 2011)
- There are some differences in WRT 1.0 and later version when we talk about using the systeminfo service object used to access a platform service. For eg: WRT 1.0 requires widgets to load the plug-in module explicitly by defining the following HTML code in their main HTML document:
<embed type="application/x-systeminfo-widget" hidden="yes"></embed>- While WRT 1.1 and later version provides an api for creating an object instance of a service interface.
nokia.device.load(interfaceName, version)
Loading Service Object - A Generic Way
- Lets continue with the example case of systeminfo platform service
// so is declared as global variable
var so;
function load() {
// Lets check if running on WRT.
if ( typeof window.widget === 'undefined')
return;
// Lets try getting SysInfo as ServiceObject
try {
so = window.device.getServiceObject("Service.SysInfo", "ISysInfo");
} catch (ex) {
// Embed SystemInfo plugin inside HTML For WRT 1.0.
so = document.createElement('embed');
so.setAttribute('type', 'application/x-systeminfo-widget');
document.body.appendChild(so);
}
}


(no comments yet)