Windows Phone SMS without confirmation

后端 未结 2 341
不思量自难忘°
不思量自难忘° 2021-01-24 22:22

Is there any possibility to send SMS without using the launcher task: SmsComposeTask in Windows Phone 7.x ? There are apps like Emergency SMS that seem to do that, meaning the S

2条回答
  •  离开以前
    2021-01-24 22:56

    Looks like with Windows 10 is now possible to do that https://github.com/Microsoft/Windows-universal-samples/blob/master/smssendandreceive/cs/smssendandreceive/sendtextmessage.xaml.cs

    Confirmed! With Windows 10 Mobile (10.0.12648.133, Build 10149) and Windows SDK 10158 I was able to send a sms without confirmation screens at all!

    Add to your package manifest XMLs: xmlns:r="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"

    Capabilities:

    the full code:

    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
    
            Task.Run(async () =>
            {
                await SendSms();
    
    
            }).ConfigureAwait(false);
    
        }
    
        SmsDevice2 device;
    
        async Task SendSms()
        {
    
            try
            {
                device = SmsDevice2.GetDefault();
            }
            catch (Exception ex)
            {
                return;
            }
    
    
            SmsTextMessage2 msg = new SmsTextMessage2();
    
            msg.To = "+1000000000";
            msg.Body = "test";
    
            SmsSendMessageResult result = await device.SendMessageAndGetResultAsync(msg);
    
        }
    

提交回复
热议问题