Help me! Why my app do not read inbox message?
-
If I run app on QT Simulator, it return "This is a test message"
But when I run on my phone (E72), it return empty string.
here is my code:
@QString smslib::readSMS()
{
QString retVal("Msg content:"");
// Match all messages whose status field includes the Incoming flag
QMessageFilter filter(QMessageFilter::byStandardFolder(QMessage::InboxFolder));
//QMessageFilter filter(QMessageFilter::byStatus(QMessage::Incoming));
// Order the matching results by their reception timestamp, in descending order
QMessageSortOrder sortOrder(QMessageSortOrder::byReceptionTimeStamp(Qt::DescendingOrder));
// Acquire a handle to the message manager
QMessageManager manager;// Find the matching message IDs, limiting our results to a managable number const int max = 100; const QMessageIdList matchingIds(manager.queryMessages(filter, sortOrder, max)); // Retrieve each message foreach (const QMessageId &id, matchingIds) { QMessage message(manager.message(id)); retVal.append(message.content()); } return retVal.append("\"");//
}
@
Thanks you! -
Check for capabilities.You need readDeviceData capability to read messages.
"Capabilities":http://developer.symbian.org/wiki/index.php/Capabilities_(Symbian_Signed)