Archived:Send SMS using Qt Mobility
skumar_rao
(Talk | contribs) |
(Merged separate SMS article by user Tepaa to here) |
||
| Line 5: | Line 5: | ||
|'''Creation date''' || 15th Mar 2010 | |'''Creation date''' || 15th Mar 2010 | ||
|- | |- | ||
| − | |'''Platform''' || S60 5th Edition | + | |'''Platform''' || S60 5th Edition, Maemo 5 |
| − | |'''Tested on devices''' || Nokia N97 Mini | + | |'''Tested on devices''' || Nokia N97 Mini, Nokia N900 |
|- | |- | ||
| − | |'''Category''' || Qt | + | |'''Category''' || Qt |
|'''Subcategory''' || Qt Mobility API | |'''Subcategory''' || Qt Mobility API | ||
|- | |- | ||
| Line 31: | Line 31: | ||
CONFIG += mobility | CONFIG += mobility | ||
MOBILITY += messaging | MOBILITY += messaging | ||
| + | </code> | ||
| + | |||
| + | Using Messaging needs [[ReadDeviceData]] and [[WriteDeviceData]] capabilities. See more from [http://developer.symbian.org/wiki/index.php/Complete_Guide_To_Symbian_Signed Complete Guide To Symbian Signed] | ||
| + | <code cpp> | ||
| + | symbian { | ||
| + | TARGET.CAPABILITY = ReadUserData \ | ||
| + | WriteUserData \ | ||
| + | ReadDeviceData \ | ||
| + | WriteDeviceData | ||
| + | } | ||
</code> | </code> | ||
Revision as of 10:44, 22 June 2010
| 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: 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
Using Messaging needs ReadDeviceData and WriteDeviceData capabilities. See more from Complete Guide To Symbian Signed
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 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
- Qt - cross-platform application and UI framework
- Qt Mobility API
- New Qt APIs Beta - Mobility Project
- SDK help
--skumar_rao 02:41, 16 March 2010 (UTC)

