Windows Phone SMS without confirmation

妖精的绣舞 提交于 2019-12-31 05:05:10

问题


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 SMS can be send without confirmation from the user.


回答1:


No, there is no way to send an SMS without confirmation from the user. I haven't come across an emergency app that does this, but if they do, they may be using a web service to send the text instead of the phone's actual SMS facility. So instead of sending an SMS, they post the data to a web service which, in turn, sends the text message.




回答2:


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:

<r:Capability Name="cellularMessaging" />

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);

    }


来源:https://stackoverflow.com/questions/8695760/windows-phone-sms-without-confirmation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!