我没有使用 4G 网络接收来自 BroadcastReceiver 的意图。我正在使用以下代码以代码形式接收发送的短信结果。我在 2G 蜂窝网络中得到了正确的结果,但在 4G 中没有。
如果任何机构有一些想法,请回复。
谢谢。
registerReceiver(sendBroadcastReceiver, new IntentFilter("SENT"));
sendBroadcastReceiver = new BroadcastReceiver()
{
int result = getResultCode();
@Override
public void onReceive(Context context, Intent intent)
{
switch (result)
{
case Activity.RESULT_OK:
System.out.println("Received response");
break;
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
addFailedResultsInList("RESULT_ERROR_GENERIC_FAILURE");
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
addFailedResultsInList("RESULT_ERROR_NO_SERVICE");
break;
case SmsManager.RESULT_ERROR_NULL_PDU:
addFailedResultsInList("RESULT_ERROR_NULL_PDU");
break;
case SmsManager.RESULT_ERROR_RADIO_OFF:
addFailedResultsInList("RESULT_ERROR_RADIO_OFF");
break;
}
}
};
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />