org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-2240F5BE-97BD-4CB3-8DB3-B5CF7C23BF54.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 messages and using messaging services"/><meta name="DC.Relation" scheme="URI" content="GUID-6FBE64B7-0949-4AAE-B835-52B276540A59"/><meta name="DC.Relation" scheme="URI" content="GUID-E3D26890-581A-427F-8AFF-16081528A8B8"/><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-2240F5BE-97BD-4CB3-8DB3-B5CF7C23BF54"/><title>Accessing
       
     5 messages and using messaging services </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-2240F5BE-97BD-4CB3-8DB3-B5CF7C23BF54">Accessing
       
     8 messages and using messaging services</h1><div>
       
     9 <p>The <a href="GUID-91579EE5-A608-401C-82B4-DCF1723EC7B5.html#GUID-91579EE5-A608-401C-82B4-DCF1723EC7B5">Messaging
       
    10 Service API</a> allows <span>widgets</span> to send, retrieve, and manage
       
    11 messages using the Messaging Center of a device. You can use the Messaging
       
    12 Service to create <span>widgets</span> that:</p>
       
    13 <ul>
       
    14 <li><p>Send SMS and MMS messages</p></li>
       
    15 <li><p>Retrieve messages stored on the device</p></li>
       
    16 <li><p>Notify the user when new messages arrive</p></li>
       
    17 <li><p>Change the status of a message</p></li>
       
    18 <li><p>Delete messages</p></li>
       
    19 </ul>
       
    20 <div><h3>Accessing the API and supported methods</h3>
       
    21 <p>To create a <a href="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html#GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080">service
       
    22 object</a> for the Messaging Service API, use <code>Service.Messaging</code> to
       
    23 identify the service provider and <code>IMessaging</code> to identify
       
    24 the supported interface:</p>
       
    25 
       
    26 <pre class="codeblock" id="GUID-70C10D6D-929D-43CF-9E2F-F51CD6DF186D">var so = device.getServiceObject("Service.Messasing", "IMessaging");</pre>
       
    27 <p>The <code>IMessaging</code> interface provides the following
       
    28 methods:</p>
       
    29 <ul>
       
    30 <li><p><a href="GUID-C12C81D1-13A4-4B8C-81B9-694D414A4A48.html#GUID-C12C81D1-13A4-4B8C-81B9-694D414A4A48"><code>GetList()</code></a></p>
       
    31 
       
    32 <p>Use the <code>GetList()</code> method to retrieve messages stored
       
    33 in the Messaging Center of a device.</p>
       
    34 
       
    35 </li>
       
    36 <li><p><a href="GUID-5295F092-004B-43F4-85DB-7C54ED14D6DB.html#GUID-5295F092-004B-43F4-85DB-7C54ED14D6DB"><code>Send()</code></a></p>
       
    37 
       
    38 <p>Use the <code>Send()</code> method to send an SMS or MMS message.</p>
       
    39 
       
    40 </li>
       
    41 <li><p><a href="GUID-DFEDF3BF-BA73-4418-815C-83B80B888821.html#GUID-DFEDF3BF-BA73-4418-815C-83B80B888821"><code>RegisterNotification()</code></a></p>
       
    42 
       
    43 <p>Use the <code>RegisterNotification()</code> method to receive
       
    44 notifications of new incoming messages.</p>
       
    45 
       
    46 </li>
       
    47 <li><p><a href="GUID-E2FDB3FB-2B5E-430C-81B5-9C0C22C4CC04.html#GUID-E2FDB3FB-2B5E-430C-81B5-9C0C22C4CC04"><code>CancelNotification()</code></a></p>
       
    48 
       
    49 <p>Use the <code>CancelNotification()</code> method to cancel notification
       
    50 of new incoming messages.</p>
       
    51 
       
    52 </li>
       
    53 <li><p><a href="GUID-74A4C52A-6150-4237-81B5-A864F01FADF5.html#GUID-74A4C52A-6150-4237-81B5-A864F01FADF5"><code>ChangeStatus()</code></a></p>
       
    54 
       
    55 <p>Use the <code>ChangeStatus()</code> method to change the read
       
    56 status of a message.</p>
       
    57 
       
    58 </li>
       
    59 <li><p><a href="GUID-BE6FB5B3-020A-44F3-A4AC-DFD0FEA42B7A.html#GUID-BE6FB5B3-020A-44F3-A4AC-DFD0FEA42B7A"><code>Delete()</code></a></p>
       
    60 
       
    61 <p>Use the <code>Delete()</code> method to delete a message.</p>
       
    62 
       
    63 </li>
       
    64 <li><p><a href="GUID-2EBDD073-499C-4A1E-A0DA-4FF8243A6479.html#GUID-2EBDD073-499C-4A1E-A0DA-4FF8243A6479"><code>Cancel()</code></a></p>
       
    65 
       
    66 <p>Use the <code>Cancel()</code> method to cancel an ongoing asynchronous
       
    67 call. This method is valid for any asynchronous call made through the Messaging
       
    68 Service API.</p>
       
    69 
       
    70 </li>
       
    71 </ul>
       
    72 </div>
       
    73 <div><h3>Using the service in a widget</h3>
       
    74 <p>To perform messaging tasks using the Messaging Service API:</p>
       
    75 <ol>
       
    76 <li id="GUID-E8ECDB2F-00C4-488F-A253-87FABDA66CA6-GENIDd0e8731"><a name="GUID-E8ECDB2F-00C4-488F-A253-87FABDA66CA6-GENIDd0e8731"><!----></a><p>Create a service
       
    77 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>
       
    78 </li>
       
    79 <li id="GUID-0625B45D-A5C9-4ADA-BC21-07963F957A7C-GENIDd0e8740"><a name="GUID-0625B45D-A5C9-4ADA-BC21-07963F957A7C-GENIDd0e8740"><!----></a><p>Define the
       
    80 messaging tasks you want to perform and choose the correct methods for them.</p>
       
    81 </li>
       
    82 <li id="GUID-DBD9997B-CD51-45F9-9ED0-38A98AF08A12-GENIDd0e8745"><a name="GUID-DBD9997B-CD51-45F9-9ED0-38A98AF08A12-GENIDd0e8745"><!----></a><p>Optionally,
       
    83 define how you want the results filtered.</p></li>
       
    84 <li id="GUID-AAB5C193-F848-4B0A-AF03-6BA7425BD10B-GENIDd0e8749"><a name="GUID-AAB5C193-F848-4B0A-AF03-6BA7425BD10B-GENIDd0e8749"><!----></a><p>Define methods
       
    85 to process the results.</p></li>
       
    86 <li id="GUID-F0C3D20F-6F77-4C88-AF35-39DA70DE701B-GENIDd0e8753"><a name="GUID-F0C3D20F-6F77-4C88-AF35-39DA70DE701B-GENIDd0e8753"><!----></a><p>Use the methods
       
    87 defined in step 2 to perform the messaging tasks. Use asynchronous methods
       
    88 together with <a href="GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608.html#GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608"><code>callback()</code></a>.</p>
       
    89 </li>
       
    90 <li id="GUID-0ABE0CB0-D76C-444B-AE53-0D435B3C6E74-GENIDd0e8762"><a name="GUID-0ABE0CB0-D76C-444B-AE53-0D435B3C6E74-GENIDd0e8762"><!----></a><p>Process the
       
    91 results in the methods defined in step 4.</p></li>
       
    92 </ol>
       
    93 <p>For the complete source of a sample widget that demonstrates how to
       
    94 use this service, see <a href="GUID-DBF41DB5-44D7-4822-A611-FBF7DA3A8F3B.html#GUID-DBF41DB5-44D7-4822-A611-FBF7DA3A8F3B">the full example</a>.</p>
       
    95 </div>
       
    96 </div></div></div><div class="footer"><hr/><div class="copy">© Nokia 2009.</div></div></body></html>