Revision as of 04:19, 11 October 2012 by hamishwillee (Talk | contribs)

Archived:How to send and receive SMS in Qt for Symbian

From Nokia Developer 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}}.

The article is no longer required because the Mobile Extension it demonstrates has been superseded by the cross platform Qt Mobility APIs

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 3rd Edition, FP1, FP2
S60 5th Edition
Platform Security
Signing Required: DevCert
Capabilities: ReadUserData, NetworkServices, WriteUserData, UserEnvironment and LocalServices
Keywords: XQMessaging::send (), XQMessage
Created: savaj (27 Jun 2009)
Last edited: hamishwillee (11 Oct 2012)



This code snippets shows how to get send and receive messages in Qt using a Mobile Extension API (deprecated). How to use Mobile Extension APIs in Qt for Symbian contains class XQMessaging and XQMessage which provide a way to send and receive messages.

This snippet requires ReadUserData, NetworkServices, WriteUserData, UserEnvironment and LocalServices. Self-signing is not possible because a Developer certificate is needed.


Headers required

 #include "XQMessaging.h"
#include "XQMessage.h"

.pro file

Add following lines to your .pro file.

symbian:LIBS += -lsendas2 \
-lmsgs \
-letext \
-lefsrv \
-lcharconv \
symbian:TARGET.CAPABILITY = NetworkServices \
LocalServices \
ReadUserData \
WriteUserData \

Send SMS

For sending SMS we need to create message with XQMessage class. After creating message, send it using send() method of XQMessaging class. The following source code demostrate how to send SMS.

Source code

void QtSMSOperation::sendSMS()
XQMessaging messaging;
XQMessage message(QStringList("98433487876"),QString("Testing"));
if (messaging.send(message) == XQMessaging::NoError)
QMessageBox msgBox;
msgBox.setText(tr("SMS was sent successfully"));

Receive SMS

XQMessaging class emitt a signal messageReceived() when SMS is received, with reference of XQMessage class which has message body and sender information. so we need to catch that signal in your slots. The following source code demostrate how to receive SMS.

/* implement signal ans slots to listen all incoming message */
QtSMSOperation::QtSMSOperation(QWidget *parent)
: QMainWindow(parent)
/* messaging is declared of type XQMessaging in header file.
* the slot receiveSMS() will get called on al incomming message */

connect(&messaging, SIGNAL(messageReceived(const XQMessage&)), this, SLOT(receiveSMS(const XQMessage&)));
/* receive incomming message */
void QtSMSOperation::receiveSMS(const XQMessage& message)
/* message.sender() contains the cell number of sender
* and message.body contain body part of message */


Code Example

  • The Code Example will show how to send and receive messages in Qt and is tested on Nokia 5800 XpressMusic.
59 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.