2

我使用此代码以编程方式发送消息。如果文本太长,我会得到“Null Pdu”。如果太短,则成功发送。怎么了?什么是空 pdu?你能修好吗?谢谢4你的帮助..(对不起英语不好)

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;
    }
}
4

1 回答 1

1

您必须将所有文本分成几部分,以便它们适合几条短信。或以彩信形式发送

于 2014-09-17T16:22:57.307 回答