Namespaces

Variants
Actions

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
croozeus (Talk | contribs)
m (Published as per Sunil's request)
skumar_rao (Talk | contribs)
Line 18: Line 18:
 
|'''Keywords (APIs, classes, methods, functions)''': QMessageServiceAction, QMessageId
 
|'''Keywords (APIs, classes, methods, functions)''': QMessageServiceAction, QMessageId
 
|}
 
|}
 
 
  
 
{{Tip| Read this article before moving forward: [[Setting up environment for Qt Mobility API]]}}
 
{{Tip| Read this article before moving forward: [[Setting up environment for Qt Mobility API]]}}
Line 36: Line 34:
  
 
===Headers===
 
===Headers===
<code>
+
<code cpp>
 
#include <qtmessaging.h>
 
#include <qtmessaging.h>
  
Line 47: Line 45:
  
 
===Source file===
 
===Source file===
<code>
+
<code cpp>
 
// connect messageseives statechange signal to our slot, to get notification     
 
// connect messageseives statechange signal to our slot, to get notification     
 
connect(&m_MessageServiceAction, SIGNAL(stateChanged(QMessageServiceAction::State)), this, SLOT(messageStateChanged(QMessageServiceAction::State)));     
 
connect(&m_MessageServiceAction, SIGNAL(stateChanged(QMessageServiceAction::State)), this, SLOT(messageStateChanged(QMessageServiceAction::State)));     

Revision as of 14:43, 15 March 2010

ID Creation date 15th Mar 2010
Platform S60 5th Edition Tested on devices Nokia N97 Mini
Category Qt for Symbian 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

Contents

Overview

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

Keywords

Project configuration file (.Pro file)

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

Headers

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

Source file

// connect messageseives statechange 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.setType(QMessage::Sms);
message.setTo(QMessageAddress(address, QMessageAddress::Phone));
message.setBody(body);
 
if (iMessageServiceAction.send(message)) {
sendId = message.id();
}
else {
// message sending failed
}
}
 
void send_sms::messageStateChanged(QMessageServiceAction::State s) {
if (s == QMessageServiceAction::Successful) {
// message send successfull
}
else {
// message sending failed
}
}

Classes

  • QMessageServiceAction
  • QMessageId

Reference links

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

×