Reputation: 1378
I was trying to send sms to a group of contacts via SmsComposeTask class. But this class's Show() method only composes message in message app. I also want my code to send those texts automatically. Please help!! Here is what i am using:
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = recipients; // recipients is the group of contacts
smsComposeTask.Body =
"Hello! This is a test sms message!";
smsComposeTask.Show();
Upvotes: 0
Views: 1492
Reputation: 4273
using Microsoft.Phone.Tasks;
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = "2065550123"; smsComposeTask.Body = "Your SMS text";
smsComposeTask.Show();
After that a dialog will be show asking the user whether to send the message.
You cannot silently send an SMS
Also: https://developer.nokia.com/Community/Wiki/How_to_send_an_SMS_in_Windows_Phone
Note: In contrast to Symbian, Windows Phone does not allow you to send sms "directly" or "silently" from your own app. As soon as sms sending initiation code below is executed the native sms editor app will be launched, giving the user the option to send the message or not.
I image this is done so that rouge apps can't send out a bunch of texts that will cost someone money.
Upvotes: 2