locked
Retreiving SMS using getMessagesAsync in JS

    Question

  • 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.




    Friday, July 27, 2012 10:56 AM

Answers

  • 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!

    Wednesday, September 19, 2012 6:47 AM

All replies

  • 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

    Tuesday, July 31, 2012 12:50 PM
    Moderator
  • 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

    Wednesday, August 01, 2012 1:29 PM
  • 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?

    Tuesday, August 07, 2012 7:29 AM
  • 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!

    Wednesday, September 19, 2012 6:47 AM
  • 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

    Friday, November 16, 2012 11:01 AM