Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor meiscai's Avatar
    Join Date
    Oct 2007
    Posts
    212
    我要实现对短信的监测,是我要监测的号码信息就删除,现在问题是:
    1.短信无法删除。
    2.我想屏蔽他短信铃声,也无法实现。

    case EMsvEntriesChanged:
    {
    TMsvId* EntryId = STATIC_CAST(TMsvId*,aArg2);
    if( *EntryId != KMsvGlobalInBoxIndexEntryId )
    {
    break;
    }
    CMsvEntrySelection* NewEntryList = STATIC_CAST(CMsvEntrySelection* ,aArg1);
    TInt i = 0;
    for(; i<NewEntryList->Count();i++)
    {
    CMsvEntry* NewEntry = iSmsSession->GetEntryL(NewEntryList->At(i));
    TMsvEntry Entry = NewEntry->Entry();

    TPtrC Detail(Entry.iDetails);//发信人号码
    TPtrC Description(Entry.iDescription);//短信内容

    WriteLog(Detail);
    WriteLog(Description);

    if(Detail.Find(_L("13125436548")) != 0)
    {

    Entry.SetInPreparation(EFalse);
    Entry.SetNew(EFalse);
    Entry.SetUnread(EFalse);
    Entry.SetVisible(EFalse);
    NewEntry->ChangeL(Entry);

    TMsvId myId = NewEntryList->At(i);
    iSmsSession->RemoveEntry(myId);
    //NewEntry->DeleteL(myId);

    }
    delete NewEntry;
    }
    delete NewEntryList;

    break;
    }
    Last edited by meiscai; 2008-02-03 at 07:59.

  2. #2
    Regular Contributor meiscai's Avatar
    Join Date
    Oct 2007
    Posts
    212
    请问3rd删除短信还要什么能力么,我捕获了一下错误码。
    TRAPD(error,NewEntry->ChangeL(Entry));

    if(error != KErrNone)
    {
    TBuf<10> look;
    look.AppendNum(error);
    WriteLog(look);
    }
    结果返回-46,好像是能力问题,请问短信的铃声屏蔽和删除要什么能力呢?

  3. #3
    Super Contributor Cxt_programmer's Avatar
    Join Date
    Feb 2006
    Location
    Beijing
    Posts
    4,360
    我得程序使用如下能力,操作短信的时候没有问题:
    ReadUserData UserEnvironment WriteUserData ReadDeviceData WriteDeviceData

    不知道为什么,SDK对这些api没有能力说明。
    Stay Hungry. Stay Foolish.
    Sina Weibo:
    http://weibo.com/cxt728
    QQ Weibo:
    http://t.qq.com/Cxt_programmer

  4. #4
    Regular Contributor meiscai's Avatar
    Join Date
    Oct 2007
    Posts
    212
    谢谢,可以了,不过EMsvEntriesChanged这个执行之后就异常退出了,程序关闭了。

  5. #5
    Super Contributor Cxt_programmer's Avatar
    Join Date
    Feb 2006
    Location
    Beijing
    Posts
    4,360
    NewEntryList 这个指针的所有权没有传递给你,不需要你来delete;问题大概出在这里了;

    另外,你只需要在change时候获取第一条:NewEntryList->At(0);检查他是否是你需要操作的短信就可以了,不用弄个for循环^_^
    Stay Hungry. Stay Foolish.
    Sina Weibo:
    http://weibo.com/cxt728
    QQ Weibo:
    http://t.qq.com/Cxt_programmer

  6. #6
    Regular Contributor meiscai's Avatar
    Join Date
    Oct 2007
    Posts
    212
    谢谢楼上的高手^_^

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved