locked
Do not have acces to use the Windows.Devices.Sms.SmsDevice Apis.

    Question

  • Hi,

    I am using following code  when receive an sms in background task.

            public void Run(Windows.ApplicationModel.Background.IBackgroundTaskInstance taskInstance)
            {         
                try
                {

                    SmsReceivedEventDetails smsDetails = (SmsReceivedEventDetails)taskInstance.TriggerDetails;

                    // search for MobileBroadbandAccount for this DeviceId and get SmsmDevice object
                   
                    smsDevice = SmsDevice.FromId( smsDetails.DeviceId );
                   
                    GetSmsMessageOperation getMessage = smsDevice.MessageStore.GetMessageAsync(smsDetails.MessageIndex);
                    getMessage.Completed = GetMessageCompletedCallback;
                    getMessage.Start();

                    System.Threading.Thread.Sleep(1000);
                    taskInstance.Canceled += new Windows.ApplicationModel.Background.BackgroundTaskCanceledEventHandler(taskInstance_Canceled);

                }
                catch (Exception e)
                {

                }
          }


            void GetMessageCompletedCallback(Windows.Foundation.IAsyncOperation<ISmsMessage> asyncInfo)
            {

             }

    Here I got Exception on GetSmsMessageOperation getMessage = smsDevice.MessageStore.GetMessageAsync(smsDetails.MessageIndex);

    What I am missing here? OR I do not have access to use SmsDevice APIs.

    Please help as This issue is urgent for me.

    Thanks,

    Vipin

    Wednesday, December 28, 2011 11:54 AM

Answers

All replies

  • Hi Vipin,

    What is the exception?  Does the 'Sms SendReceive' sample work for you?

    -Jeff


    Jeff Sanders (MSFT)
    Wednesday, December 28, 2011 1:59 PM
    Moderator
  • Hi Jeff,

     With my code mentioned above(In C#) for receiving message, I got exception with message: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)).

    Also I wrote a sample C# code to send SMS also which give me same exception i.e.  The remote procedure call failed.

    I also tried javaScript(as C# sample is not available there) Sms SendReceive sample. my observations mentioned below:

    1. Able to receive the SMS.

    2. Not able to send the SMS. as it gives error on message Box: SMS did not setup: Error: The remote procedure call failed. 

        On subsequent try to send SMS gives  Error:  SMS did not setup: Error: The RPC server is unavailable.

    I debugged and found it gives exception with message : The remote procedure call failed. (Exception from HRESULT: 0x800706BE)

     

    Note:- I wrote a sample code to received sms and it also working fine in application. but when I use same code in background task it gives me Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)). 

    Please suggest, why I am getting this Catastrophic failure exception while try to receive the SMS as shown in code above. 

     

    Thanks,

    Vipin


    • Edited by viptyagi Thursday, December 29, 2011 11:07 AM
    Thursday, December 29, 2011 10:03 AM
  • Hi Jeff,
     
    Please suggest solution to overcome to this issue.
     
    As this issue is urgent for me. I have mentioned details and observations related to this.
     
    Thanks,
     
    Vipin
    Friday, December 30, 2011 8:15 AM
  • Hi All,

    I am still waiting for help to resolve this issue.

    Please suggest to overcome to this issue.

    Thanks,

    Vipin

    Wednesday, January 04, 2012 9:58 AM
  • Hi All,

    I am still waiting for help to resolve this issue.

    Please suggest to overcome to this issue.

    Thanks,

    Vipin


    Hi All,

    Still I am not able to resolve the issue. as facing same problem as mentioned above.

    Please someone suggest to overcome to this issue.

    Thanks,

    Vipin

    Friday, January 06, 2012 9:39 AM
  • Vipin,

    These APIs are available only to Mobile Broadband operators.

    Best Wishes - Eric


    Monday, June 04, 2012 6:40 PM
    Moderator