问题
I have read on different forums that we can send 160 (7 bit) characters and 140 (8 bit) bytes in one SMS message.
I want to send 140 bytes of data in one SMS. I am can successfully send up to 133 bytes but not more than 133 bytes, Can any one guide Why I am unable to send 140 bytes of 8 bit data in one SMS through smsManager.sendDataMessage
Below is my code.
int MAX_SMS_MESSAGE_LENGTH = 140;
byte[] bArray = new byte [MAX_SMS_MESSAGE_LENGTH];
for(int i=0;i<MAX_SMS_MESSAGE_LENGTH;i++)
{
bArray[i] = (byte)i;
}
PendingIntent sent = this.createPendingResult(SENT, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT);
String messageText = _message.getText().toString();
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendDataMessage(_phoneNumber.getText().toString(), null, SMS_PORT, bArray, sent, null);
Thanking in an Anticipation,
Regards,
AK
回答1:
Part of the 140 bytes is reserved for the User Data Header (UDH) which is usually 7 bytes in size. More info can be found here.
来源:https://stackoverflow.com/questions/23180842/how-can-i-send-140-byte-in-one-sms-by-senddatamessage