October 8, 2010

hungchuviet hungchuviet
Lab Rat
37 posts

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:

  1. QString smslib::readSMS()
  2. {
  3.     QString retVal("Msg content:\"");
  4.     // Match all messages whose status field includes the Incoming flag
  5.     QMessageFilter filter(QMessageFilter::byStandardFolder(QMessage::InboxFolder));
  6.     //QMessageFilter filter(QMessageFilter::byStatus(QMessage::Incoming));
  7.     // Order the matching results by their reception timestamp, in descending order
  8.     QMessageSortOrder sortOrder(QMessageSortOrder::byReceptionTimeStamp(Qt::DescendingOrder));
  9.     // Acquire a handle to the message manager
  10.     QMessageManager manager;
  11.  
  12.     // Find the matching message IDs, limiting our results to a managable number
  13.     const int max = 100;
  14.     const QMessageIdList matchingIds(manager.queryMessages(filter, sortOrder, max));
  15.     // Retrieve each message    
  16.     foreach (const QMessageId &id, matchingIds) {
  17.         QMessage message(manager.message(id));
  18.         retVal.append(message.content());
  19.     }
  20.     return retVal.append("\"");//
  21. }

Thanks you!

1 reply

October 8, 2010

archerabi archerabi
Lab Rat
25 posts

Check for capabilities.You need readDeviceData capability to read messages.

Capabilities [developer.symbian.org])

 
  ‹‹ Face book in Qt      Qt 4.7 on Symbian^3 (as it is on N8) ››

You must log in to post a reply. Not a member yet? Register here!