org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html
changeset 229 716254ccbcc0
equal deleted inserted replaced
228:913c9751c067 229:716254ccbcc0
       
     1 
       
     2 <!DOCTYPE html
       
     3   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
     4 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="copyright" content="(C) Copyright 2009"/><meta name="DC.rights.owner" content="(C) Copyright 2009"/><meta name="DC.Type" content="mobileconcept"/><meta name="DC.Title" content="getServiceObject()"/><meta name="DC.Relation" scheme="URI" content="GUID-7C69DDA4-16F1-4A8F-BDB2-4CB0015B4E81"/><meta name="DC.Relation" scheme="URI" content="GUID-571AF37F-1E95-462A-92D2-FEA2E62F1559"/><meta name="DC.Format" content="XHTML"/><meta name="DC.Identifier" content="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080"/><title>getServiceObject() </title><script type="text/javascript">
       
     5       function initPage() {}
       
     6     </script><link href="../PRODUCT_PLUGIN/book.css" rel="stylesheet" type="text/css"/><link href="css/s60/style.css" rel="stylesheet" type="text/css" media="all"/></head><body onload="initPage();"><div class="body"><div class="contentLeft prTxt"><h1 class="pageHeading" id="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080">getServiceObject()</h1><div>
       
     7 <p><strong>Description:</strong></p>
       
     8 <p>The <code>getServiceObject</code> method creates an object that
       
     9 is used to access the services made available through a <a href="GUID-65AAF569-D347-462B-B59A-9D7CA184AB9C.html#GUID-65AAF569-D347-462B-B59A-9D7CA184AB9C">Service
       
    10 API</a>. This object is referred to as a "service object".</p>
       
    11 <p><strong>Syntax:</strong></p>
       
    12 <pre class="codeblock" id="GUID-F1580D9E-555B-4F59-95E5-3D6779BABE2E">so = device.getServiceObject(provider, interface);</pre>
       
    13 <p><strong>Arguments:</strong></p>
       
    14 <ul>
       
    15 <li><p><code>provider</code>:</p>
       
    16 
       
    17 <p>This is a text string that defines the service provider name, that is,
       
    18 the name of the type of service object to create.</p>
       
    19 
       
    20 </li>
       
    21 <li><p><code>interface</code>:</p>
       
    22 
       
    23 <p>This is a text string that defines the supported interface for the specified
       
    24 service provider.</p>
       
    25 
       
    26 </li>
       
    27 </ul>
       
    28 <div class="tablenoborder"><a name="GUID-310FC91B-219B-4105-9601-E3B04849575D"><!----></a><table cellpadding="4" cellspacing="0" summary="" id="GUID-310FC91B-219B-4105-9601-E3B04849575D" frame="border" border="1" rules="all"><caption><strong>Table: </strong>Service API providers
       
    29 and interfaces</caption>
       
    30 <thead align="left">
       
    31 <tr class="title "><th class="cellrowborder" valign="top" id="d0e16777">
       
    32 <p>Service API</p>
       
    33 </th><th class="cellrowborder" valign="top" id="d0e16782">
       
    34 <p>Provider</p>
       
    35 </th><th class="cellrowborder" valign="top" id="d0e16787">
       
    36 <p>Interface</p>
       
    37 </th></tr>
       
    38 </thead>
       
    39 <tbody>
       
    40 <tr class="">
       
    41 <td class="cellrowborder" valign="top" headers="d0e16777 ">
       
    42 <p><a href="GUID-2D651505-F68C-4053-B565-9FF826C5B897.html#GUID-2D651505-F68C-4053-B565-9FF826C5B897">AppManager</a></p>
       
    43 </td>
       
    44 <td class="cellrowborder" valign="top" headers="d0e16782 ">
       
    45 <p><code>Service.AppManager</code></p>
       
    46 </td>
       
    47 <td class="cellrowborder" valign="top" headers="d0e16787 ">
       
    48 <p><code>IAppManager</code></p>
       
    49 </td>
       
    50 </tr>
       
    51 <tr class="bg ">
       
    52 <td class="cellrowborder" valign="top" headers="d0e16777 ">
       
    53 <p><a href="GUID-CABB28B8-D2B1-496B-BD7E-34FF496E60B4.html#GUID-CABB28B8-D2B1-496B-BD7E-34FF496E60B4">Calendar</a></p>
       
    54 </td>
       
    55 <td class="cellrowborder" valign="top" headers="d0e16782 ">
       
    56 <p><code>Service.Calendar</code></p>
       
    57 </td>
       
    58 <td class="cellrowborder" valign="top" headers="d0e16787 ">
       
    59 <p><code>IDataSource</code></p>
       
    60 </td>
       
    61 </tr>
       
    62 <tr class="">
       
    63 <td class="cellrowborder" valign="top" headers="d0e16777 ">
       
    64 <p><a href="GUID-A5853293-7B83-4CCE-9C29-B2B8F0CD8A18.html#GUID-A5853293-7B83-4CCE-9C29-B2B8F0CD8A18">Contacts</a></p>
       
    65 </td>
       
    66 <td class="cellrowborder" valign="top" headers="d0e16782 ">
       
    67 <p><code>Service.Contact</code></p>
       
    68 </td>
       
    69 <td class="cellrowborder" valign="top" headers="d0e16787 ">
       
    70 <p><code>IDataSource</code></p>
       
    71 </td>
       
    72 </tr>
       
    73 <tr class="bg ">
       
    74 <td class="cellrowborder" valign="top" headers="d0e16777 ">
       
    75 <p><a href="GUID-B8845FF1-D7F6-476A-8651-8B9C12D8789F.html#GUID-B8845FF1-D7F6-476A-8651-8B9C12D8789F">Landmarks</a></p>
       
    76 </td>
       
    77 <td class="cellrowborder" valign="top" headers="d0e16782 ">
       
    78 <p><code>Service.Landmarks</code></p>
       
    79 </td>
       
    80 <td class="cellrowborder" valign="top" headers="d0e16787 ">
       
    81 <p><code>IDataSource</code></p>
       
    82 </td>
       
    83 </tr>
       
    84 <tr class="">
       
    85 <td class="cellrowborder" valign="top" headers="d0e16777 ">
       
    86 <p><a href="GUID-53CE4DE6-F065-4339-8C18-5C30A9540053.html#GUID-53CE4DE6-F065-4339-8C18-5C30A9540053">Location</a></p>
       
    87 </td>
       
    88 <td class="cellrowborder" valign="top" headers="d0e16782 ">
       
    89 <p><code>Service.Location</code></p>
       
    90 </td>
       
    91 <td class="cellrowborder" valign="top" headers="d0e16787 ">
       
    92 <p><code>ILocation</code></p>
       
    93 </td>
       
    94 </tr>
       
    95 <tr class="bg ">
       
    96 <td class="cellrowborder" valign="top" headers="d0e16777 ">
       
    97 <p><a href="GUID-F003B7DD-E450-49AD-B447-C5132FE47D3C.html#GUID-F003B7DD-E450-49AD-B447-C5132FE47D3C">Logging</a></p>
       
    98 </td>
       
    99 <td class="cellrowborder" valign="top" headers="d0e16782 ">
       
   100 <p><code>Service.Logging</code></p>
       
   101 </td>
       
   102 <td class="cellrowborder" valign="top" headers="d0e16787 ">
       
   103 <p><code>IDataSource</code></p>
       
   104 </td>
       
   105 </tr>
       
   106 <tr class="">
       
   107 <td class="cellrowborder" valign="top" headers="d0e16777 ">
       
   108 <p><a href="GUID-E5684FF0-28C9-4721-9421-6B9432087086.html#GUID-E5684FF0-28C9-4721-9421-6B9432087086">Media Management</a></p>
       
   109 </td>
       
   110 <td class="cellrowborder" valign="top" headers="d0e16782 ">
       
   111 <p><code>Service.MediaManagement</code></p>
       
   112 </td>
       
   113 <td class="cellrowborder" valign="top" headers="d0e16787 ">
       
   114 <p><code>IDataSource</code></p>
       
   115 </td>
       
   116 </tr>
       
   117 <tr class="bg ">
       
   118 <td class="cellrowborder" valign="top" headers="d0e16777 ">
       
   119 <p><a href="GUID-91579EE5-A608-401C-82B4-DCF1723EC7B5.html#GUID-91579EE5-A608-401C-82B4-DCF1723EC7B5">Messaging</a></p>
       
   120 </td>
       
   121 <td class="cellrowborder" valign="top" headers="d0e16782 ">
       
   122 <p><code>Service.Messaging</code></p>
       
   123 </td>
       
   124 <td class="cellrowborder" valign="top" headers="d0e16787 ">
       
   125 <p><code>IMessaging</code></p>
       
   126 </td>
       
   127 </tr>
       
   128 <tr class="">
       
   129 <td class="cellrowborder" valign="top" headers="d0e16777 ">
       
   130 <p><a href="GUID-B77C2006-879F-4AC6-B7BF-04B25B563A29.html#GUID-B77C2006-879F-4AC6-B7BF-04B25B563A29">Sensor</a></p>
       
   131 </td>
       
   132 <td class="cellrowborder" valign="top" headers="d0e16782 ">
       
   133 <p><code>Service.Sensor</code></p>
       
   134 </td>
       
   135 <td class="cellrowborder" valign="top" headers="d0e16787 ">
       
   136 <p><code>ISensor</code></p>
       
   137 </td>
       
   138 </tr>
       
   139 <tr class="bg ">
       
   140 <td class="cellrowborder" valign="top" headers="d0e16777 ">
       
   141 <p><a href="GUID-AEB26A58-1DE2-46CB-81EC-6DB3A477B7A3.html#GUID-AEB26A58-1DE2-46CB-81EC-6DB3A477B7A3">SystemInfo</a></p>
       
   142 </td>
       
   143 <td class="cellrowborder" valign="top" headers="d0e16782 ">
       
   144 <p><code>Service.SysInfo</code></p>
       
   145 </td>
       
   146 <td class="cellrowborder" valign="top" headers="d0e16787 ">
       
   147 <p><code>ISysInfo</code></p>
       
   148 </td>
       
   149 </tr>
       
   150 </tbody>
       
   151 </table></div>
       
   152 <p><strong>Return value:</strong></p>
       
   153 <p>If the call succeeds, the <code>getServiceObject</code> method
       
   154 returns a service object; otherwise it returns <code>undefined</code>.</p>
       
   155 <p><strong>Remarks:</strong></p>
       
   156 <ul>
       
   157 <li><p>The <code>getServiceObject</code> method is a factory
       
   158 method found on the <code>device</code> object.</p></li>
       
   159 <li><p>To ensure backward compatibility, always check in your JavaScript
       
   160 code that the <code>device</code> object exists before calling the <code>getServiceObject</code> method.
       
   161 For example:</p>
       
   162 
       
   163 <pre class="codeblock" id="GUID-B43A804D-CBB6-44E4-9514-E1982EA50507">if (device != "undefined")
       
   164   device.getServiceObject("Service.MediaManagement", "IDataSource");
       
   165 </pre>
       
   166 
       
   167 </li>
       
   168 </ul>
       
   169 <p><strong>Example code:</strong></p>
       
   170 <p>The following example creates a service object for the <a href="GUID-E5684FF0-28C9-4721-9421-6B9432087086.html#GUID-E5684FF0-28C9-4721-9421-6B9432087086">Media
       
   171 Management Service API</a>:</p>
       
   172 <pre class="codeblock" id="GUID-00E9306D-0D8D-44DC-BA87-899BB4F9B000">var so = device.getServiceObject("Service.MediaManagement", "IDataSource");</pre>
       
   173 </div></div></div><div class="footer"><hr/><div class="copy">© Nokia 2009.</div></div></body></html>