【发布时间】:2017-06-14 12:02:46
【问题描述】:
从我的 android 应用程序发送短信时,我可以获得发送/接收短信的状态。 使用以下代码发送,
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNo, null, msg, sentIntent, deliveredIntent);
其中,sentIntent 和 deliveredIntent 是待定意图
我可以成功获取 SMS 发送/发送报告(从我的应用程序发送时)。
但是,当我使用默认消息应用程序发送 SMS 时,BroadcastReceiver 不会被调用。
我为我的 BroadcastReceiver 类添加了以下过滤器
<receiver android:name=".SMSBReceiver">
<intent-filter android:priority="1000" >
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
<action android:name="android.provider.Telephony.SEND_SMS" />
</receiver>
【问题讨论】:
-
你设置短信权限了吗?
<uses-permission android:name="android.permission.SEND_SMS"/> -
是的,我可以从我的应用程序中发送短信。如果我使用默认消息应用发送短信,我想获得发送响应
-
如果我是从我的应用程序发送的,还可以获得短信发送状态。那么,如何获取默认消息应用短信发送报告。
标签: android sms sendmessage telephony smsmanager