Need help: Can not get SMS messages when using Qt Mobility SDK on Qt Creator
-
Hi,
I met a problem when using mobility SDK to get SMS information on N900. I found that many ppl have same problem like me, and there hasn't been any correct answer for this problem on Internet.
My problem is: I try the QMessage modules of mobility sdk on N900. I used qt creator the build the packet and run the application on N900. I want to get some information about the SMS messages on my phone, and I'm sure that I have many messages in SMS inbox. But when trying to fetch SMS messages from the inbox, nothing can be gotten. I'm pretty sure that my code is correct. Because the E-Mail message can be fetched when I change the QMessage::Sms to QMessage::Email!
One key point is that I'm using the latest firmware 1.2 version on N900, and the Qt 4.6.2 as well. All necessary packages are well installed on my phone as well. I can not see any problem with the phone :(.
I hope I can find the final solution of this problem with you guys help, either from Qt aspect or N900 aspect. Then I can continue building my application.
The code I used:
@#include <QtGui>
#include <QMessage>
#include <QMessageManager>
using namespace QtMobility;int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);QMessageManager manager; QMessageIdList list = manager.queryMessages(QMessageFilter::byType(QMessage::Sms)); qDebug() << list.count(); for (int i = 0; i < list.size(); ++i) { QMessageId id = list.at(i); QMessage message = manager.message(id); qDebug() << message.from().addressee() << message.textContent(); } a.exec();
}@
The same problem threads can be found here:
"http://discussion.forum.nokia.com/forum/showthread.php?205340-QMessageManager-gt-queryMessages-works-in-simulator-but-not-in-N900":http://discussion.forum.nokia.com/forum/showthread.php?205340-QMessageManager-gt-queryMessages-works-in-simulator-but-not-in-N900
"http://discussion.forum.nokia.com/forum/showthread.php?205423-QMessageManager-message(id)-conn-t-get-the-message-object":http://discussion.forum.nokia.com/forum/showthread.php?205423-QMessageManager-message(id)-conn-t-get-the-message-object
Looking forward to your reply!
thx.
[edit: fixed link / chetankjain]
-
I was fighting with the same problem and decided to ask around on maemo.org. Thanks to those people there I found out that most likely it is permission issue! QTCreator uses developer user to run the software on the device and that user is not able to do that querymessages for users SMS messages correctly.
I don't yet know how to circumvent this directly from QTCreator but you can confirm this by going to xconsole in your n900 and typing "su user <enter> appname<enter>" and it works.
Please contact me if you find out how to make qtcreator work correctly with this.
Thx, Tero
-
Please see this thread. We have solved this problem in QtCreator!