问题
I would like to create a Windows Phone 8.1 app that sends the location of the device to a contact in the contact list of the phone via a SMS message. How do I send a SMS message?
回答1:
In Windows Phone 8.1, You can send sms using ChatMessageManager:
Windows.ApplicationModel.Chat.ChatMessage msg
= new Windows.ApplicationModel.Chat.ChatMessage();
msg.Body = "This is body of demo message.";
msg.Recipients.Add("10086");
msg.Recipients.Add("10010");
await Windows.ApplicationModel.Chat.ChatMessageManager
.ShowComposeSmsMessageAsync(msg);
There are 2 important params in it: Body and Recipients.
Body is the content you will send.
Recipients is the contact list who will receive the sms.
回答2:
You can use the SMS Compose Task to send an SMS message: http://msdn.microsoft.com/en-us/library/windows/apps/hh394005(v=vs.105).aspx
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = "2065550123";
smsComposeTask.Body = "Try this new application. It's great!";
smsComposeTask.Show();
回答3:
Try this
SmsComposeTask SMSCompose = new SmsComposeTask();
SMSCompose.To = "<Number to which the SMS needs to be sent";
SMSCompose.Body = "Message that needs to be sent";
SMSCompose.Show();
来源:https://stackoverflow.com/questions/24894069/how-to-send-a-sms-message-from-within-an-windows-phone-8-1-app