×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Send SMS using Qt Mobility

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Added category Category:Symbian. (Preparing for ontology change))
hamishwillee (Talk | contribs)
m (Remove platform specifier categories (only need specifier for Qt if there is some platform specific behaviour))
Line 1: Line 1:
[[Category:Qt for Symbian]]
+
[[Category:Qt]]
 
{{KBCS}}
 
{{KBCS}}
  
Line 21: Line 21:
 
|}
 
|}
  
{{Tip| Read this article before moving forward: [[Setting up environment for Qt Mobility API]]}}
+
{{Warning|This example is outdated and may not compile with new sdks; see this for new  examples http://wiki.forum.nokia.com/index.php/Qt_Mobility_API_Basic_Examples_Part_1'''}}
  
== Note ==
+
{{Tip| Read this article before moving forward: [[Setting up environment for Qt Mobility API]]}}
'''This is outdated example and may not compile with new sdks; see this for new  examples http://wiki.forum.nokia.com/index.php/Qt_Mobility_API_Basic_Examples_Part_1'''
+
--[[User:Rahul.kulshreshtha|[B]Please choose Notification type as "Instant Email Notification". It must be default.[/B]]] 11:02, 11 November 2010 (UTC)
+
  
 
== Overview ==  
 
== Overview ==  
Line 100: Line 98:
 
* [http://labs.trolltech.com/page/Projects/QtMobility Qt Mobility API]
 
* [http://labs.trolltech.com/page/Projects/QtMobility Qt Mobility API]
 
* [http://qt.nokia.com/developer/new-qt-apis New Qt APIs Beta - Mobility Project]
 
* [http://qt.nokia.com/developer/new-qt-apis New Qt APIs Beta - Mobility Project]
* SDK help[[Category:Code Examples]][[Category:Code Snippet]] [[Category:Qt]] [[Category:Symbian]]
+
* SDK help [[Category:Code Examples]][[Category:Code Snippet]]

Revision as of 07:27, 4 April 2011

Template:KBCS

ID CS001616 Creation date July 7 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

Warning.pngWarning: This example is outdated and may not compile with new sdks; see this for new examples http://wiki.forum.nokia.com/index.php/Qt_Mobility_API_Basic_Examples_Part_1

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

Contents

Overview

The following code shows how to send an 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

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 {
TARGET.CAPABILITY = ReadUserData \
WriteUserData \
ReadDeviceData \
WriteDeviceData
}

Headers

#include <qtmessaging.h>
 
private slots:
void messageStateChanged(QMessageServiceAction::State s);
private:
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.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 successful
}
else {
// message sending failed
}
}

Classes

Reference links

198 page views in the last 30 days.
×