How to use the SMS compose task for Windows Phone
May 03, 2013
Applies to: Windows Phone 8 | Windows Phone OS 7.1
Use the SMS compose task to enable users to send a message from your application. The SMS compose task launches the Messaging application with a new SMS message displayed. You can optionally specify recipients and a message body that are prepopulated in the new message. The message is not sent until the user presses the send button.
By using Launchers, you help provide a consistent user experience throughout the Windows Phone platform. For more information, see Launchers and Choosers for Windows Phone.
Note: |
|---|
On Windows Phone Emulator, the SMS message always appears to be sent successfully, but the message is not actually sent. The emulator uses Fake GSM and always has a false Subscriber Identity Module (SIM) card. |
To use the SMS compose task
Add the following statement to your code.
Add the following code to your application wherever you need it, such as in a button click event. To test this procedure, you can put the code in the page constructor. This is the code to launch the task.
SmsComposeTask smsComposeTask = new SmsComposeTask(); smsComposeTask.To = "2065550123"; smsComposeTask.Body = "Try this new application. It's great!"; smsComposeTask.Show();
Note:If the phone does not have a SIM card, the phone receives a toast notification when the message fails to be sent.