diff -r 913c9751c067 -r 716254ccbcc0 org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html Fri Mar 05 19:11:15 2010 -0800 @@ -0,0 +1,173 @@ + + +getServiceObject()

getServiceObject()

+

Description:

+

The getServiceObject method creates an object that +is used to access the services made available through a Service +API. This object is referred to as a "service object".

+

Syntax:

+
so = device.getServiceObject(provider, interface);
+

Arguments:

+
    +
  • provider:

    + +

    This is a text string that defines the service provider name, that is, +the name of the type of service object to create.

    + +
  • +
  • interface:

    + +

    This is a text string that defines the supported interface for the specified +service provider.

    + +
  • +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table: Service API providers +and interfaces
+

Service API

+
+

Provider

+
+

Interface

+
+

AppManager

+
+

Service.AppManager

+
+

IAppManager

+
+

Calendar

+
+

Service.Calendar

+
+

IDataSource

+
+

Contacts

+
+

Service.Contact

+
+

IDataSource

+
+

Landmarks

+
+

Service.Landmarks

+
+

IDataSource

+
+

Location

+
+

Service.Location

+
+

ILocation

+
+

Logging

+
+

Service.Logging

+
+

IDataSource

+
+

Media Management

+
+

Service.MediaManagement

+
+

IDataSource

+
+

Messaging

+
+

Service.Messaging

+
+

IMessaging

+
+

Sensor

+
+

Service.Sensor

+
+

ISensor

+
+

SystemInfo

+
+

Service.SysInfo

+
+

ISysInfo

+
+

Return value:

+

If the call succeeds, the getServiceObject method +returns a service object; otherwise it returns undefined.

+

Remarks:

+
    +
  • The getServiceObject method is a factory +method found on the device object.

  • +
  • To ensure backward compatibility, always check in your JavaScript +code that the device object exists before calling the getServiceObject method. +For example:

    + +
    if (device != "undefined")
    +  device.getServiceObject("Service.MediaManagement", "IDataSource");
    +
    + +
  • +
+

Example code:

+

The following example creates a service object for the Media +Management Service API:

+
var so = device.getServiceObject("Service.MediaManagement", "IDataSource");
+
\ No newline at end of file