Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIndows Phone Runtime app sms

I need send sms from my app. I find many articles how to do that, but, not work for me.

        try
        {
            ChatMessage msg = new ChatMessage {Body = "C# is the best!!"};
            msg.Recipients.Add("number");
            ChatMessageStore cms = await ChatMessageManager.RequestStoreAsync();
            await cms.SendMessageAsync(msg);
        }
        catch (Exception e)
        {
        //TODO: There I want show user sms app, but do not know how
        }

I do not have permission to do that, in documentation I found I need cellularMessaging capability https://msdn.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations . But I do not have in visual studio this option I have Contacts, Internet, Locations and others here but not celllurar. I try add it handly, but not work to.

<Capability Name="cellular" />
<uap:Capability Name="cellular" />
...

How can I do that? I have windows phone 8.1 runtime app project. I want get work this on W10m and WP8.1

like image 480
Peter Pan Avatar asked Oct 18 '22 06:10

Peter Pan


1 Answers

Sending SMS messages programmatically isn't available to everyone - you have to request special permissions to Microsoft to be able to do it (and it is usually restricted to high profile clients like mobile operators). See the following remark taken from https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.sms.smsdevicemessagestore.aspx

Note This functionality is only available to mobile operator apps and Windows Store apps given privileged access by mobile network operators, mobile broadband adapter IHV, or OEM. For more information, see Mobile Broadband: Windows Store device apps.

However, you can call ChatMessageManager.ShowComposeSmsMessageAsync to tell the OS to show the native SMS composing app with the data you have already filled in - then the user will be able to confirm the message for sending.

like image 149
r2d2rigo Avatar answered Jan 04 '23 05:01

r2d2rigo