×
Namespaces

Variants
Actions

Changing the status of a message in Symbian Web Runtime

From Nokia Developer Wiki
Jump to: navigation, search

This code snippet demonstrates how to change the status ("Read" or "Unread") of an SMS. The code snippet uses the Messaging Platform Service for Web Runtime, supported from S60 5th Edition onwards.

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 5th Edition
S60 5th Edition
Article
Keywords: device.getServiceObject(), Service.IMessaging.GetList(), Service.IMessaging.ChangeStatus()
Created: ivruban (26 Feb 2009)
Last edited: hamishwillee (04 Oct 2012)

Contents

Source: Relevant HTML components

<div id="bodyContent" class="bodyContent">
<select size="5" id="messageList" multiple></select><br />
 
<input type="radio" name="choiceStatus" id="read" />
<label for="read">Read</label><br />
 
<input type="radio" name="choiceStatus" id="unread" />
<label for="unread">Unread</label><br />
 
<input type="button" onclick="changeStatus();"
value="Change status" />
</div>

Source

/**
* Changes the status of the selected message.
*/

function changeStatus() {
var messageListElement = document.getElementById("messageList");
var criteria = new Object();
for (var msgIndex = 0; msgIndex < messageListElement.length; msgIndex++) {
if (messageListElement.options[msgIndex].selected) {
// Get message id of the selected message
var messageId = messageListElement.options[msgIndex].value;
// Get numeric representation of the message id
criteria.MessageId = parseInt(messageId, 10);
 
if (document.getElementById("read").checked) {
criteria.Status = "Read";
} else {
criteria.Status = "Unread";
}
 
// Change the status of the message
var result = serviceObj.IMessaging.ChangeStatus(criteria);
if (result.ErrorCode !== 0) {
alert("Error: " + result.ErrorCode);
break;
}
}
}
alert("Status changed.");
getMessageList();
}

Postconditions

The status of the selected message is changed to Read or Unread, depending on the user's selection.

See also

Supplementary material

This code snippet is part of the stub concept, which means that it has been patched on top of a template application in order to be more useful to developers. The version of the WRT stub application used as a template in this snippet is v1.1.

This page was last modified on 4 October 2012, at 08:53.
111 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×