如果文字太长,RESULT_ERROR_NULL_PDU?

时间:2012-10-04 19:05:43

标签: android text sms

我使用此代码以编程方式发送消息。如果文字太长,我得到“Null Pdu”...如果短,成功发送。怎么了?什么是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;
    }
}

1 个答案:

答案 0 :(得分:1)

您必须将所有文本划分为多个部分,以便它们适合几个短信。或将其作为彩信发送