2
我使用此代碼以編程方式發送消息。如果文本太長,我得到「空Pdu」。如果短,成功發送。怎麼了?什麼是空pdu?你能修理傢伙嗎?謝謝你4幫助..(對不起英語)RESULT_ERROR_NULL_PDU如果文本太長?
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;
}
}
你有沒有得到解決?我有同樣的問題:( –
是啊@Joubert Vasconcelos,如果使用sendMultipartTextMessage解決,這裏示例代碼: SmsManager sms = SmsManager.getDefault(); ArrayList parts = sms.divideMessage(sms.sendMultipartTextMessage(phoneNumber,null,parts ,sentPIList,deliveredPIList); –