3

我正在使用https://github.com/Pyo25/phonegap-sms-sending-plugin发送短信并且发送正常,但是,即使没有网络覆盖/飞行模式,插件仍然会返回我状态。好的不发送短信。

有没有办法保证或检查消息状态?

我尝试在我的 sendSMS java 中注册一个广播接收器,但它没有注册

 registerReceiver(new BroadcastReceiver(){
@Override
public void onReceive(Context arg0, Intent arg1) {
  switch (getResultCode())
  {
    case Activity.RESULT_OK:
      Toast.makeText(getBaseContext(), "SMS sent",
        Toast.LENGTH_SHORT).show();
      break;
    case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
      Toast.makeText(getBaseContext(), "Generic failure",
        Toast.LENGTH_SHORT).show();
      break;
    case SmsManager.RESULT_ERROR_NO_SERVICE:
      Toast.makeText(getBaseContext(), "No service",
        Toast.LENGTH_SHORT).show();
      break;
    case SmsManager.RESULT_ERROR_NULL_PDU:
      Toast.makeText(getBaseContext(), "Null PDU",
        Toast.LENGTH_SHORT).show();
      break;
    case SmsManager.RESULT_ERROR_RADIO_OFF:
      Toast.makeText(getBaseContext(), "Radio off",
        Toast.LENGTH_SHORT).show();
      break;
  }
}

}, 新的 IntentFilter(smsSent));

4

1 回答 1

1

这很好用!它具有发送和交付意图

http://androidopera.blogspot.com/2013/03/smsplugin-phonegap-android.html#comment-form

于 2013-05-07T03:13:10.880 回答