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 over the next few weeks. Thanks for all your past and future contributions.

(Difference between revisions)

Archived:Send SMS using Qt Mobility

From Wiki
Jump to: navigation, search
jimgilmour1 (Talk | contribs)
m (assign author as Skumar rao)
seppo_fn (Talk | contribs)
Line 34: Line 34:
Using Messaging needs [[ReadUserData]], [[WriteUserData] capabilities from ''user granted'' category.
Using Messaging needs [[ReadUserData]] and [[WriteUserData]] capabilities from the ''user granted'' category.
It also needs [[ReadDeviceData]] and [[WriteDeviceData]] capabilities from ''open signed online'' category. Read more about [[Capabilities]].
It also needs [[ReadDeviceData]] and [[WriteDeviceData]] capabilities from ''open signed online'' category. Read more about [[Capabilities]].
Line 88: Line 88:
* QMessageServiceAction
* [ QMessageServiceAction]
* QMessageId
* [ QMessageId]
== Reference links==
== Reference links==

Revision as of 08:10, 29 June 2010

Author Skumar rao

ID Creation date 15th Mar 2010
Platform S60 5th Edition, Maemo 5 Tested on devices Nokia N97 Mini, Nokia N900
Category Qt Subcategory Qt Mobility API

Keywords (APIs, classes, methods, functions): QMessageServiceAction, QMessageId

Tip.pngTip: Read this article before moving forward: Setting up environment for Qt Mobility API



The below code shows how to send a SMS using Qt Mobility


Project configuration file (.Pro file)

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

Using Messaging needs ReadUserData and WriteUserData capabilities from the user granted category. It also needs ReadDeviceData and WriteDeviceData capabilities from 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

--skumar_rao 02:41, 16 March 2010 (UTC)

154 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.