简体   繁体   English

在Android中使用SmsManager.sendTextMessage方法发送空白短信

[英]send blank SMS with SmsManager.sendTextMessage method in android

I created an android app and one of its functions is to send SMS, when I try to send blank SMS it throws an exception. 我创建了一个android应用,其功能之一就是发送短信,当我尝试发送空白短信时会引发异常。

Here is the code: 这是代码:

SmsManager sm=SmsManager.getDefault();
sm.sendTextMessage("9999", null, messageBody,sentPI, deliveredPI);

messageBody maybe empty string and maybe it is a string, previous method throws IllegalArgumentException when messageBody is empty string! messageBody可能是空字符串,也可能是字符串,而当messageBody为空字符串时,先前的方法将抛出IllegalArgumentException!

what can I do to send blank SMS? 如何发送空白短信?

After looking at the Documentation : 查看文档后

This method: 该方法:

Throws 投掷

IllegalArgumentException    if destinationAddress or text are empty

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

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