I am trying to read SMS messages from Symbian phone inbox. I created an app with Qt Creator and got it working in Symbian Simulator, but in Nokia N8 it cannot read any messages (SMS or email).
Here is my minimal code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtCore/QCoreApplication>
#include <QMessageManager>
QTM_USE_NAMESPACE
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
QMessageManager mm;
QMessageIdList msgs = mm.queryMessages();
ui->textBrowser->append(QString("Messages %1").arg(msgs.size()));
for (int i = 0; i < msgs.count(); ++i) {
QMessage message = mm.message(msgs.at(i));
ui->textBrowser->append(message.from().addressee());
ui->textBrowser->append(message.to().at(0).addressee());
ui->textBrowser->append(message.textContent());
}
}
// ...rest is boilerplate code
In simulator this prints the test messages it has. In N8 it displays only "Messages 0" although there are SMS and email messages.
In .pro file I have declared
CONFIG += mobility
MOBILITY += messaging
I am new to Qt so this may well be something everyone takes for granted. I tried debug and release builds, and also copying the sis file Qt Creator created to the phone and installing it, but the result is the same.
Check out User guide: Symbian Signed. For reading SMS messages, you need to add ReadUserData capability for symbian. In .pro file, add
symbian:TARGET.CAPABILITY += ReadUserData