people in couch

How to send SMS in Windows Phone 7 using C# ?

The developers can make use of the SMSComposeTask launcher to send the SMS in Windows Phone 7.

How to send SMS in Windows Phone 7 using C# ?

To send the SMS in Windows Phone 7 using SMSComposeTask by including the namespace Microsoft.Phone.Tasks

using Microsoft.Phone.Tasks;

The Microsoft.Phone.Tasks namespace includes the classes necessary for all the Launcher and Chooser tasks .

Now , create the instance of the SMSComposerTask and set its “To” field to a valid number and the “Body” property to a text to be sent .

private void button1_Click(object sender, RoutedEventArgs e)
{
     SmsComposeTask composeSMS = new SmsComposeTask();
     composeSMS.Body = " This is a Test SMS sent using SmsComposeTask launcher";
     composeSMS.To = "1765432548";
     composeSMS.Show();
}

The Show method will display the SMSComposer screen which requires the user interaction to send the SMS .


Currently , the Windows Phone 7 does not supports directly sending the sms without the SMS Compose Screen .We may have to wait and watch to see if it will be available later .

    9 Comments

  1. Tushar
    May 25, 2011
    Reply

    I want to send the SMS programatically, as I do it in Android. Lets see how long do we have to wait for this.

  2. SifriG
    August 1, 2011
    Reply

    Thank You!!

    its works!

  3. Le@rner
    August 1, 2011
    Reply

    hi all,

    i want to send sms from windows phone 7?

    i am check the SmsComposeTask for this but its just show the message compose window with assigned value of number and msg body.

    i want to send the sms directly from app without the user initiating.

    i read this may be possible by Push Notification so please help me for this.

    thanks in advance.

  4. Peter
    September 23, 2011
    Reply

    Sending SMS without user interaction is not allowed.
    Vicious people could then write an app that sends charging SMS’s in the background without the user knowing about it.

  5. jonathan ditya
    January 14, 2012
    Reply

    hello, i try to send an sms in windows phone emulator, but it doesnt working…
    can you help me??

  6. January 14, 2012
    Reply

    In emulator , you can only go upto the compose SMS , then when you click send , you will not be able to do because it does not have cellular connection . try this on the Windows Device it will work …

  7. jonathan ditya
    January 18, 2012
    Reply

    thanks for you answer Mr. senthil kumar..
    i have been connected my laptop to GSM modem, have write a code for connected port and database.. but really doesnt work… i
    can you help me to solve this problem..
    iam sorrr, im newbie… thanks before…

  8. deepanshu
    August 19, 2013
    Reply

    what if the user press the hardware button without sending the message. I need to know if there is anything that confirm that the message is send from the phone. Or how to intimate the user that sending message is required.

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...