简体   繁体   English

如何在C#应用程序中获取SMS传递?

[英]how to get SMS delivery in my C# Application?

I want to send SMS with C# in my Windows Mobile (6.1) and get the delivery report too. 我想在Windows Mobile(6.1)中使用C#发送SMS并获取发送报告。

I know I can send SMS with below code: 我知道我可以使用以下代码发送短信:

string str = "hello world";
            SmsMessage sms = new SmsMessage("09******", str);
            sms.Send();

and I know i can get the delivery report with below code: 而且我知道我可以使用以下代码获取交付报告:

  sms.RequestDeliveryReport = true or false;

but in this way I just see notification and I need to handle it in my program , not just notification. 但是通过这种方式,我只看到通知,并且需要在程序中处理通知,而不仅仅是通知。

I need to see the Message status too. 我也需要查看消息状态。 For eg: 例如:

SMS state like sent successfully or no GSM Antena and ....so on. 短信状态如发送成功或没有GSM Antena等等。

Thank you 谢谢

At least i found a solution. 至少我找到了解决方案。

when you try below code : 当您尝试以下代码时:

 sms.RequestDeliveryReport = true;

C# will give you a event that notify to you that your last message have been received. C#将为您提供一个事件,通知您已收到您的最后一条消息。 it will give it to you like a new message. 它会像一条新消息一样给您。

for SMS Status , you get exception if phone can not send Message. 对于短信状态,如果手机无法发送短信,您将获得例外。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM