SmsManager.SendTextMessage 抛出异常

SmsManager.SendTextMessage throws exception

我正在使用 VS 2015 并从我的 nexus 4 设备进行调试。 为什么这一行抛出异常(与任何 phone 数字相同的结果 - 包括实数)? (未显示详细信息)。

SmsManager.Default.SendTextMessage("123456789", null, "bbbbb", null, null);

我找到了使用 SmsManager 的示例 here:

SmsManager sms = SmsManager.getDefault();
PendingIntent sentPI;
String SENT = "SMS_SENT";

sentPI = PendingIntent.getBroadcast(this, 0,new Intent(SENT), 0);

sms.sendTextMessage(phoneNumber, null, message, sentPI, null);

来自评论:

sendTextMessage() method sends the SMS message with a PendingIntent.PendingIntent object is used to identify a target to invoke at a later time. We can monitor the status of the SMS message sending process this way.

并且需要以下权限:

<uses-permission android:name="android.permission.SEND_SMS" />