Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

(Redirected from Send SMS using Qt Mobility)

Archived:Send SMS using Qt Mobility

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

This example is outdated and may not compile with new sdks; see this for new examples Qt Mobility API Basic Examples Part 1

The following code shows how to send an SMS using Qt Mobility.

Article Metadata
Tested with
Devices(s): Nokia N97 Mini, Nokia N900
Platform(s): S60 5th Edition, Maemo 5
Platform Security
Signing Required: DevCert required
Capabilities: ReadUserData, WriteUserData, ReadDeviceData, WriteDeviceData
Keywords: QMessageServiceAction, QMessageId
Created: skumar_rao (07 Jul 2010)
Last edited: hamishwillee (17 Oct 2012)


Project configuration file (.Pro file)

  • Add the Qt Mobility project configuration option in the .Pro file as shown below
CONFIG += mobility
MOBILITY += messaging

The use of Messaging requires the ReadUserData and WriteUserData capabilities from the user granted category. It also requires the ReadDeviceData and WriteDeviceData capabilities from the open signed online category. Read more about Capabilities.

symbian {
WriteUserData \
ReadDeviceData \


#include <qtmessaging.h>
private slots:
void messageStateChanged(QMessageServiceAction::State s);
QMessageServiceAction m_MessageServiceAction;
QMessageId m_sendId;

Source file

// connect messages state-change signal to our slot, to get notification    
connect(&m_MessageServiceAction, SIGNAL(stateChanged(QMessageServiceAction::State)), this, SLOT(messageStateChanged(QMessageServiceAction::State)));
void send_sms::QtSendSMSMessage(QString address, QString body) {
// Prepare QMessage with address & body
QMessage message;
message.setTo(QMessageAddress(address, QMessageAddress::Phone));
if (iMessageServiceAction.send(message)) {
sendId =;
else {
// message sending failed
void send_sms::messageStateChanged(QMessageServiceAction::State s) {
if (s == QMessageServiceAction::Successful) {
// message send successful
else {
// message sending failed


Reference links

This page was last modified on 17 October 2012, at 22:24.
121 page views in the last 30 days.