你能告诉我如何在黑莓 10 中阅读短信(测试消息)收件箱。我使用了消息文件夹 api。在我的设备中有 6 条短信。但调试时显示为零。这是我的代码
void Testmesagges::inboxSmsTest(){
fprintf(stderr,"*****in*******\n");
qDebug() << "***************Thegtf is************************* ";
bb::pim::message::MessageService messageService;
bb::pim::account::AccountService accountService;
//Get the SMS/MMS account
QList<Account> accountList = accountService.accounts(Service::Messages,"sms-mms");
fprintf(stderr,"*****count*******\n");
qDebug() << accountList.count();
fprintf(stderr,"*****Length*******\n");
qDebug() << accountList.length();
AccountKey accountId;
if(accountList.count()>0){
accountId = accountList.first().id();
qDebug() << "***************The is************************* ";
fprintf(stderr,"*****ID*******\n");
qDebug() << accountId;
QList<MessageFolder> folders = messageService.folders(accountId);
fprintf(stderr,"*****size*******\n");
qDebug() << folders.size();
fprintf(stderr,"*****count*******\n");
qDebug() << folders.count();
fprintf(stderr,"*****length*******\n");
qDebug() << folders.length();
MessageFolder firstFolder = folders.at(0);
qDebug() << firstFolder.isValid();
qDebug() << firstFolder.name();
}
}