org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-2240F5BE-97BD-4CB3-8DB3-B5CF7C23BF54.html
author Eugene Ostroukhov <eugeneo@symbian.org>
Thu, 15 Jul 2010 10:08:51 -0700
changeset 450 ed815e0eef9a
parent 229 716254ccbcc0
permissions -rw-r--r--
Bug 3268 - Debugger does not start on Windows XP


<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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
messages and using messaging services </title><script type="text/javascript">
      function initPage() {}
    </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
messages and using messaging services</h1><div>
<p>The <a href="GUID-91579EE5-A608-401C-82B4-DCF1723EC7B5.html#GUID-91579EE5-A608-401C-82B4-DCF1723EC7B5">Messaging
Service API</a> allows <span>widgets</span> to send, retrieve, and manage
messages using the Messaging Center of a device. You can use the Messaging
Service to create <span>widgets</span> that:</p>
<ul>
<li><p>Send SMS and MMS messages</p></li>
<li><p>Retrieve messages stored on the device</p></li>
<li><p>Notify the user when new messages arrive</p></li>
<li><p>Change the status of a message</p></li>
<li><p>Delete messages</p></li>
</ul>
<div><h3>Accessing the API and supported methods</h3>
<p>To create a <a href="GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080.html#GUID-04095E9A-50E7-4E5F-BD6F-71DA281A0080">service
object</a> for the Messaging Service API, use <code>Service.Messaging</code> to
identify the service provider and <code>IMessaging</code> to identify
the supported interface:</p>

<pre class="codeblock" id="GUID-70C10D6D-929D-43CF-9E2F-F51CD6DF186D">var so = device.getServiceObject("Service.Messasing", "IMessaging");</pre>
<p>The <code>IMessaging</code> interface provides the following
methods:</p>
<ul>
<li><p><a href="GUID-C12C81D1-13A4-4B8C-81B9-694D414A4A48.html#GUID-C12C81D1-13A4-4B8C-81B9-694D414A4A48"><code>GetList()</code></a></p>

<p>Use the <code>GetList()</code> method to retrieve messages stored
in the Messaging Center of a device.</p>

</li>
<li><p><a href="GUID-5295F092-004B-43F4-85DB-7C54ED14D6DB.html#GUID-5295F092-004B-43F4-85DB-7C54ED14D6DB"><code>Send()</code></a></p>

<p>Use the <code>Send()</code> method to send an SMS or MMS message.</p>

</li>
<li><p><a href="GUID-DFEDF3BF-BA73-4418-815C-83B80B888821.html#GUID-DFEDF3BF-BA73-4418-815C-83B80B888821"><code>RegisterNotification()</code></a></p>

<p>Use the <code>RegisterNotification()</code> method to receive
notifications of new incoming messages.</p>

</li>
<li><p><a href="GUID-E2FDB3FB-2B5E-430C-81B5-9C0C22C4CC04.html#GUID-E2FDB3FB-2B5E-430C-81B5-9C0C22C4CC04"><code>CancelNotification()</code></a></p>

<p>Use the <code>CancelNotification()</code> method to cancel notification
of new incoming messages.</p>

</li>
<li><p><a href="GUID-74A4C52A-6150-4237-81B5-A864F01FADF5.html#GUID-74A4C52A-6150-4237-81B5-A864F01FADF5"><code>ChangeStatus()</code></a></p>

<p>Use the <code>ChangeStatus()</code> method to change the read
status of a message.</p>

</li>
<li><p><a href="GUID-BE6FB5B3-020A-44F3-A4AC-DFD0FEA42B7A.html#GUID-BE6FB5B3-020A-44F3-A4AC-DFD0FEA42B7A"><code>Delete()</code></a></p>

<p>Use the <code>Delete()</code> method to delete a message.</p>

</li>
<li><p><a href="GUID-2EBDD073-499C-4A1E-A0DA-4FF8243A6479.html#GUID-2EBDD073-499C-4A1E-A0DA-4FF8243A6479"><code>Cancel()</code></a></p>

<p>Use the <code>Cancel()</code> method to cancel an ongoing asynchronous
call. This method is valid for any asynchronous call made through the Messaging
Service API.</p>

</li>
</ul>
</div>
<div><h3>Using the service in a widget</h3>
<p>To perform messaging tasks using the Messaging Service API:</p>
<ol>
<li id="GUID-E8ECDB2F-00C4-488F-A253-87FABDA66CA6-GENIDd0e8731"><a name="GUID-E8ECDB2F-00C4-488F-A253-87FABDA66CA6-GENIDd0e8731"><!----></a><p>Create a service
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>
</li>
<li id="GUID-0625B45D-A5C9-4ADA-BC21-07963F957A7C-GENIDd0e8740"><a name="GUID-0625B45D-A5C9-4ADA-BC21-07963F957A7C-GENIDd0e8740"><!----></a><p>Define the
messaging tasks you want to perform and choose the correct methods for them.</p>
</li>
<li id="GUID-DBD9997B-CD51-45F9-9ED0-38A98AF08A12-GENIDd0e8745"><a name="GUID-DBD9997B-CD51-45F9-9ED0-38A98AF08A12-GENIDd0e8745"><!----></a><p>Optionally,
define how you want the results filtered.</p></li>
<li id="GUID-AAB5C193-F848-4B0A-AF03-6BA7425BD10B-GENIDd0e8749"><a name="GUID-AAB5C193-F848-4B0A-AF03-6BA7425BD10B-GENIDd0e8749"><!----></a><p>Define methods
to process the results.</p></li>
<li id="GUID-F0C3D20F-6F77-4C88-AF35-39DA70DE701B-GENIDd0e8753"><a name="GUID-F0C3D20F-6F77-4C88-AF35-39DA70DE701B-GENIDd0e8753"><!----></a><p>Use the methods
defined in step 2 to perform the messaging tasks. 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>
</li>
<li id="GUID-0ABE0CB0-D76C-444B-AE53-0D435B3C6E74-GENIDd0e8762"><a name="GUID-0ABE0CB0-D76C-444B-AE53-0D435B3C6E74-GENIDd0e8762"><!----></a><p>Process the
results in the methods defined in step 4.</p></li>
</ol>
<p>For the complete source of a sample widget that demonstrates how to
use this service, see <a href="GUID-DBF41DB5-44D7-4822-A611-FBF7DA3A8F3B.html#GUID-DBF41DB5-44D7-4822-A611-FBF7DA3A8F3B">the full example</a>.</p>
</div>
</div></div></div><div class="footer"><hr/><div class="copy">© Nokia 2009.</div></div></body></html>