SMS Receiving using DOTNET C#

Posted by sheery on Stack Overflow See other posts from Stack Overflow or by sheery
Published on 2010-04-17T05:55:17Z Indexed on 2010/04/17 6:03 UTC
Read the original article Hit count: 286

Filed under:

Hi dears, I have build an application using C# to send and receive sms, my application works fine for sending sms but when i try to read sms from my mobile through my application i get following error "Error: Phone reports generic communication error or syntax error." can any one help me in this matter, my syntax for reading sms is

private void btnReadMessages_Click(object sender, System.EventArgs e) { Cursor.Current = Cursors.WaitCursor;

        string storage = GetMessageStorage();

        try
        {
            // Read all SMS messages from the storage
            DecodedShortMessage[] messages = comm.ReadMessages(PhoneMessageStatus.All, storage);
            foreach(DecodedShortMessage message in messages)
            {
                Output(string.Format("Message status = {0}, Location = {1}/{2}",
                    StatusToString(message.Status), message.Storage, message.Index));
                ShowMessage(message.Data);
                Output("");
            }
            Output(string.Format("{0,9} messages read.", messages.Length.ToString()));
            Output("");
        }
        catch(Exception ex)
        {
            ShowException(ex);
        }

        Cursor.Current = Cursors.Default;
    }

© Stack Overflow or respective owner

Related posts about c#