已答复 Retreiving SMS using getMessagesAsync in JS

  • 2012年7月27日 10:56
     
      包含代码

    Hi,

    I'm trying to retrieve sms messages using getMessagesAsync in a js app without much success. After I've successfully retrieved the default sms device I'm using the following code:-

    smsDevice.messageStore.getMessagesAsync(Windows.Devices.Sms.SmsMessageFilter.read).done(function(messages) {
      WinJs.log("Success");
    }, function (error) {
      WinJs.log("getMessagesAsync Error:" + error);
    });

    The error handler is always called with error "The parameter is incorrect". Any idea where I'm going wrong?

    Best regards

    Mike

    P.S. I'm developing for a mobile operator and therefore have access to the privileged api's.




全部回复

  • 2012年7月31日 12:50
    版主
     
     

    Hi,

      >> P.S. I'm developing for a mobile operator and therefore have access to the privileged api's.

    Yes, according to the document, this method is available to mobile operator apps. While you mentioned you’re working on a mobile operator app, please check again if it is correct. You can also refer to http://msdn.microsoft.com/library/windows/hardware/hh770508 for more information about SMS.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework

  • 2012年8月1日 13:29
     
     

    Hi Ming,

    Thanks for the reply. Just wondering how I "check again if that is correct" that I'm working on a mobile operator app -  I am working on a mobile operator app that currently accesses other aspects of the mobile broadband api successfully!

    I've checked the whitepaper you suggested but it doesn't seem to actually mention the getMessagesAsync function at all, only retrieving single messages through getMessageAsync. Has the method been deprecated?

    Best regards

    Mike

  • 2012年8月7日 7:29
     
     

    facing the same problem here too, even I used the same code snippet from white paper, Im getting error like "parameter incorrect".

    any solution for this problem?

  • 2012年9月19日 6:47
     
     已答复

    Hi,

    The method of getMessagesAsync() can invoke like this:getMessagesAsync(Windows.Devices.Sms.SmsMessageFilter.read|Windows.Devices.Sms.SmsMessageFilter.unread)? And after invoking the method of getMessagesAsync(Windows.Devices.Sms.SmsMessageFilter.read)., the SMS list sort by what,time or others?

    Thank you!

  • 2012年11月16日 11:01
     
     

    Hi,

    So I'm now on Win8 release Pro and still see the same error:-

    "The parameter is incorrect"

    I'm doing exactly as you said in the previous post. I've checked that I'm working on a mobile application and yes I still am. I'm accessing all other aspects of the broadband api's so my app does have privileges to do so but I'm still seeing the same error.

    Has anybody managed to get it working? Are there any sample apps that demo this functionality?

    Best regards

    Mike