Table of contents
Collapse the table of content
Expand the table of content

Read received SMS by using the text-mode interface

Last Updated: 1/24/2017

You can choose between using the text-mode read interface, which is suitable for simple plain text SMS messages, or the PDU-mode mode read interface, which is suitable for advanced control of decoding SMS messages.

Received messages are stored in encoded format on mobile broadband devices. The Mobile Broadband SMS platform supports decoding received messages to plain text. The character sets that are supported for decoding received messages are the same as the character sets supported for encoding messages sent.

The following table lists the character encodings supported by the text-mode API:

Network typeCharacter setsCharacter limit for single SMS segmentCharacter limit for multi-part SMS segments


GSM 7-bit default alphabet and GSM 7-bit default alphabet extension table




7-bit ASCII

160 (can vary by network)



70 (can vary by network)

JavaScript code example for reading received SMS messages using the text-mode interface

  if (smsDevice!= null)
    var messageStore = smsDevice.messageStore;
    var messageID = id('whichMessage').value;

    var getSmsMessageOperation = messageStore.getMessageAsync(messageID);

    getSmsMessageOperation.operation.completed = function ()
      result = getSmsMessageOperation.operation.getResults();
      var readableMessage = new Windows.Devices.Sms.SmsTextMessage.fromBinaryMessage(result);
      id('fromWho').innerHTML = readableMessage.from;
      id('fromMessageBody').innerHTML = readableMessage.body;
      console.log("Successfully retrieved message " + messageID + " from message store.");
    console.log("No SMS Device Found");
catch (err) 
  console.log("SMS did not set up: " + err);

SMS client apps can use the decoded segmentation information that is provided by Windows to concatenate multiple segments of a long message and reconstruct the full message. For more info about segmented SMS messages, see Windows automatically segments long messages.

Developing SMS apps

Send comments about this topic to Microsoft

© 2017 Microsoft