org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-D581028C-06ED-422D-866E-AE6C93075084.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="Accessing and managing information about landmarks"/><meta name="DC.Relation" scheme="URI" content="GUID-4DDE31C7-EC0D-4EEC-BC3A-A0B0351154F8"/><meta name="DC.Relation" scheme="URI" content="GUID-662F2E2E-9538-42E5-9B5A-5664F1C11A9E"/><meta name="DC.Relation" scheme="URI" content="GUID-1EFD7043-E9B8-4B4E-9EA6-A20B3EECC14A"/><meta name="DC.Relation" scheme="URI" content="GUID-46EABDC1-37CB-412A-ACAD-1A1A9466BB68"/><meta name="DC.Format" content="XHTML"/><meta name="DC.Identifier" content="GUID-D581028C-06ED-422D-866E-AE6C93075084"/><title>Accessing
       
     5 and managing information about landmarks </title><script type="text/javascript">
       
     6       function initPage() {}
       
     7     </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-D581028C-06ED-422D-866E-AE6C93075084">Accessing
       
     8 and managing information about landmarks</h1><div>
       
     9 <p>The <a href="GUID-B8845FF1-D7F6-476A-8651-8B9C12D8789F.html#GUID-B8845FF1-D7F6-476A-8651-8B9C12D8789F">Landmarks
       
    10 Service API</a> allows <span>widgets</span> to access and manage information
       
    11 about landmarks and landmark categories. This information is stored in one
       
    12 or more landmark databases on a device. You can use the Landmarks Service
       
    13 to create <span>widgets</span> that:</p>
       
    14 <ul>
       
    15 <li><p>Retrieve information about landmarks, landmark categories,
       
    16 and landmark databases</p></li>
       
    17 <li><p>Create, edit, and delete landmarks and landmark categories</p>
       
    18 </li>
       
    19 <li><p>Import and export landmarks</p></li>
       
    20 <li><p>Organize landmarks into landmark categories</p></li>
       
    21 </ul>
       
    22 <p>The Landmarks Service involves the following concepts:</p>
       
    23 <ul>
       
    24 <li><p><strong>Landmark</strong> is defined as a location with a name. The
       
    25 location of a landmark is expressed as a set of geographical coordinates accompanied
       
    26 by either coordinate measurement accuracy information or a textual description,
       
    27 such as an address. A landmark can be used as Point of Interest (POI). Each
       
    28 landmark has a unique ID that distinguishes it from other landmarks in the
       
    29 same database. The ID is assigned when the landmark is added to the database.</p>
       
    30 
       
    31 <p>For detailed information about landmark objects, see section <a href="GUID-2B3FD0AF-2552-46AB-83B5-F404506D16EE.html#GUID-2B3FD0AF-2552-46AB-83B5-F404506D16EE">Landmark</a>.</p>
       
    32 
       
    33 </li>
       
    34 <li><p><strong>Landmark category</strong> groups landmarks according to type
       
    35 and interest. For example, a category can denote geographical or architectural
       
    36 interest, or it can relate to a particular type of attraction or activity.
       
    37 Each category has a unique name and ID that distinguish it from other categories
       
    38 in the same database. The ID is assigned when the category is added to the
       
    39 database.</p>
       
    40 
       
    41 <p>Landmark categories are further classified as follows:</p>
       
    42 
       
    43 <ul>
       
    44 <li><p><strong>Local categories</strong> are created by the user for a specific
       
    45 database. A local category is only valid for landmarks in the same database
       
    46 for which the category was created.</p></li>
       
    47 <li><p><strong>Global categories</strong> exist across all databases and have
       
    48 unique global IDs associated with them. Global categories are valid for all
       
    49 landmarks in all databases. Accommodation, Businesses, and Education, for
       
    50 example, are global categories.</p></li>
       
    51 </ul>
       
    52  
       
    53 <p>For detailed information about landmark category objects, see section <a href="GUID-40EAD781-6B30-406E-B05F-0BE932EFE86A.html#GUID-40EAD781-6B30-406E-B05F-0BE932EFE86A">Landmark category</a>.</p>
       
    54 
       
    55 </li>
       
    56 <li><p><strong>Landmark database</strong> stores landmarks and landmark categories.
       
    57 Each database has a unique URI that identifies the database.</p>
       
    58 
       
    59 <p>Landmark databases are further classified as follows:</p>
       
    60 
       
    61 <ul>
       
    62 <li><p><strong>Local databases</strong> reside on the device or on some device
       
    63 mapped to the device's file system. The default database is <code>file://c:eposlm.ldb</code>.
       
    64 If the device does not contain the default database, it is created when it
       
    65 is called for the first time by a service request.</p>
       
    66 
       
    67 <p>The URI of a local landmark database consists of a protocol specifier
       
    68 and the database location: <code>file://&lt;location&gt;</code>. If no
       
    69 protocol is specified, <code>file://</code> is used by default. The
       
    70 location consists of the drive and the database file name, for example <code>c:landmarks.ldb</code>.
       
    71 The path to the file cannot be specified. The extension of the database file
       
    72 name must be <code>ldb</code>.</p>
       
    73 
       
    74 </li>
       
    75 <li><p><strong>Remote databases</strong> reside in third-party servers and
       
    76 are accessed using a specific protocol. Creating or deleting remote databases
       
    77 results in adding or removing a bookmark on the device, respectively.</p>
       
    78 <div class="note"><p><strong class="note_title">Note: </strong>Remote databases and associated operations are not currently supported.</p>
       
    79 </div>
       
    80 </li>
       
    81 </ul>
       
    82  
       
    83 <p>For detailed information about landmark database objects, see section <a href="GUID-5A23A9AC-2BC4-4D05-82FF-980986CFF4F6.html#GUID-5A23A9AC-2BC4-4D05-82FF-980986CFF4F6">Landmark database</a>.</p>
       
    84 
       
    85 </li>
       
    86 </ul>
       
    87 <div><h3>Accessing the API and supported methods</h3>
       
    88 <p>To create a <a href="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html#GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080">service
       
    89 object</a> for the Landmarks Service API, use <code>Service.Landmarks</code> to
       
    90 identify the service provider and <code>IDataSource</code> to identify
       
    91 the supported interface:</p>
       
    92 
       
    93 <pre class="codeblock" id="GUID-3B84DF19-5D49-49E6-9A22-A97066C3FF8C">var so = device.getServiceObject("Service.Landmarks", "IDataSource");</pre>
       
    94 
       
    95 
       
    96 
       
    97 <p/>
       
    98 <p>The <code>IDataSource</code> interface provides the following
       
    99 methods:</p>
       
   100 <ul>
       
   101 <li><p><a href="GUID-E138B464-2086-4E74-B356-ACF8687BBB5A.html#GUID-E138B464-2086-4E74-B356-ACF8687BBB5A"><code>New()</code></a></p>
       
   102 
       
   103 <p>Use the <code>New()</code> method to create an empty landmark
       
   104 or landmark category item. You can use this item as a template.</p>
       
   105 
       
   106 </li>
       
   107 <li><p><a href="GUID-55591BBC-49F8-407D-98F5-1D2FCD5DFB34.html#GUID-55591BBC-49F8-407D-98F5-1D2FCD5DFB34"><code>GetList()</code></a></p>
       
   108 
       
   109 <p>Use the <code>GetList()</code> method to retrieve information
       
   110 about landmarks, landmark categories, or landmark databases.</p>
       
   111 
       
   112 </li>
       
   113 <li><p><a href="GUID-D85C2567-F041-42A1-A2B5-650FCAAD60A9.html#GUID-D85C2567-F041-42A1-A2B5-650FCAAD60A9"><code>Add()</code></a></p>
       
   114 
       
   115 <p>Use the <code>Add()</code> method to add a new landmark or landmark
       
   116 category to a landmark database. You can also use this method to edit an existing
       
   117 landmark or landmark category.</p>
       
   118 
       
   119 </li>
       
   120 <li><p><a href="GUID-2B13380C-37C8-473F-B0A7-564439312DA3.html#GUID-2B13380C-37C8-473F-B0A7-564439312DA3"><code>Delete()</code></a></p>
       
   121 
       
   122 <p>Use the <code>Delete()</code> method to delete a landmark or
       
   123 landmark category from a landmark database.</p>
       
   124 <div class="note"><p><strong class="note_title">Note: </strong>You cannot delete landmark databases.</p>
       
   125 </div>
       
   126 
       
   127 </li>
       
   128 <li><p><a href="GUID-4D4E5B3E-ABC4-43CA-A7E8-027C46BD1FE6.html#GUID-4D4E5B3E-ABC4-43CA-A7E8-027C46BD1FE6"><code>Import()</code></a></p>
       
   129 
       
   130 <p>Use the <code>Import()</code> method to import landmarks to
       
   131 a landmark database.</p>
       
   132 
       
   133 </li>
       
   134 <li><p><a href="GUID-A9024277-4FA2-429D-9C54-A155ED658B32.html#GUID-A9024277-4FA2-429D-9C54-A155ED658B32"><code>Export()</code></a></p>
       
   135 
       
   136 <p>Use the <code>Export()</code> method to export landmarks from
       
   137 a landmark database.</p>
       
   138 
       
   139 </li>
       
   140 <li><p><a href="GUID-B8869924-0E95-4543-954E-5A4246922CB4.html#GUID-B8869924-0E95-4543-954E-5A4246922CB4"><code>Organise()</code></a></p>
       
   141 
       
   142 <p>Use the <code>Organise()</code> method to add landmarks to a
       
   143 landmark category or to remove landmarks from a landmark category.</p>
       
   144 
       
   145 </li>
       
   146 <li><p><a href="GUID-6D7228E7-8E06-495D-85F7-A4B1716D4CDE.html#GUID-6D7228E7-8E06-495D-85F7-A4B1716D4CDE"><code>Cancel()</code></a></p>
       
   147 
       
   148 <p>Use the <code>Cancel()</code> method to cancel an ongoing asynchronous
       
   149 call. This method is valid for any asynchronous call made through the Landmarks
       
   150 Service API.</p>
       
   151 
       
   152 </li>
       
   153 </ul>
       
   154 </div>
       
   155 <div><h3>Using the service in a widget</h3>
       
   156 <p>To access and manage landmark information using the Landmarks Service
       
   157 API:</p>
       
   158 <ol>
       
   159 <li id="GUID-E8ECDB2F-00C4-488F-A253-87FABDA66CA6-GENIDd0e7896"><a name="GUID-E8ECDB2F-00C4-488F-A253-87FABDA66CA6-GENIDd0e7896"><!----></a><p>Create a service
       
   160 object for the API using <a href="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html#GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080"><code>device.getServiceObject()</code></a>.</p>
       
   161 </li>
       
   162 <li id="GUID-0625B45D-A5C9-4ADA-BC21-07963F957A7C-GENIDd0e7905"><a name="GUID-0625B45D-A5C9-4ADA-BC21-07963F957A7C-GENIDd0e7905"><!----></a><p>Define the
       
   163 tasks you want to perform and choose the correct methods for them.</p>
       
   164 </li>
       
   165 <li id="GUID-DBD9997B-CD51-45F9-9ED0-38A98AF08A12-GENIDd0e7910"><a name="GUID-DBD9997B-CD51-45F9-9ED0-38A98AF08A12-GENIDd0e7910"><!----></a><p>Optionally,
       
   166 define how you want the results filtered.</p></li>
       
   167 <li id="GUID-AAB5C193-F848-4B0A-AF03-6BA7425BD10B-GENIDd0e7914"><a name="GUID-AAB5C193-F848-4B0A-AF03-6BA7425BD10B-GENIDd0e7914"><!----></a><p>Define methods
       
   168 to process the results.</p></li>
       
   169 <li id="GUID-F0C3D20F-6F77-4C88-AF35-39DA70DE701B-GENIDd0e7918"><a name="GUID-F0C3D20F-6F77-4C88-AF35-39DA70DE701B-GENIDd0e7918"><!----></a><p>Retrieve the
       
   170 results using the methods from step 2. Use asynchronous methods together with <a href="GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608.html#GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608"><code>callback()</code></a>.</p>
       
   171 </li>
       
   172 <li id="GUID-0ABE0CB0-D76C-444B-AE53-0D435B3C6E74-GENIDd0e7927"><a name="GUID-0ABE0CB0-D76C-444B-AE53-0D435B3C6E74-GENIDd0e7927"><!----></a><p>Process the
       
   173 results using the methods defined in step 4.</p></li>
       
   174 </ol>
       
   175 <p>For the complete source of a sample widget that demonstrates how to
       
   176 use this service, see <a href="GUID-11D59F76-EC4C-4297-B262-D5174E826B43.html#GUID-11D59F76-EC4C-4297-B262-D5174E826B43">the
       
   177 full example</a>.</p>
       
   178 </div>
       
   179 </div></div></div><div class="footer"><hr/><div class="copy">© Nokia 2009.</div></div></body></html>