package android.telephony;
import static android.telephony.TelephonyManager.PHONE_TYPE_CDMA;
A Short Message Service message.
SMS Class enumeration.
See TS 23.038.
UNKNOWN, CLASS_0, CLASS_1, CLASS_2, CLASS_3;
User data text encoding code unit size
The maximum number of payload bytes per message
The maximum number of payload bytes per message if a user data header
is present. This assumes the header only contains the
CONCATENATED_8_BIT_REFERENCE element.
The maximum number of payload septets per message
The maximum number of payload septets per message if a user data header
is present. This assumes the header only contains the
CONCATENATED_8_BIT_REFERENCE element.
Contains actual SmsMessage. Only public for debugging and for framework layer.
return "SubmitPdu: encodedScAddress = "
Create an SmsMessage from a raw PDU.
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromPdu(pdu);
wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.createFromPdu(pdu);
TS 27.005 3.4.1 lines[0] and lines[1] are the two lines read from the
+CMT unsolicited response (PDU mode, of course)
+CMT: [<alpha>],<length><CR><LF><pdu>
Only public for debugging and for RIL
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromCMT(lines);
wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.newFromCMT(lines);
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromCMTI(line);
wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.newFromCMTI(line);
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromCDS(line);
wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.newFromCDS(line);
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromParcel(p);
wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.newFromParcel(p);
Create an SmsMessage from an SMS EF record.
- Parameters:
index Index of SMS record. This should be index in ArrayList
returned by SmsManager.getAllMessagesFromSim + 1.data Record data.- Returns:
- An SmsMessage representing the record.
- Hide:
return wrappedMessage != null ? new SmsMessage(wrappedMessage) : null;
Get the TP-Layer-Length for the given SMS-SUBMIT PDU Basically, the
length in bytes (not hex chars) less the SMSC header
Calculates the number of SMS's required to encode the message body and
the number of characters remaining until the next message.
- Parameters:
msgBody the message to encodeuse7bitOnly if true, characters that are not part of the
radio-specific 7-bit encoding are counted as single
space chars. If false, and if the messageBody contains
non-7-bit encodable characters, length is calculated
using a 16-bit encoding.- Returns:
- an int[4] with int[0] being the number of SMS's
required, int[1] the number of code units used, and
int[2] is the number of code units remaining until the
next message. int[3] is an indicator of the encoding
code unit size (see the ENCODING_* definitions in this
class).
com.android.internal.telephony.cdma.SmsMessage.calculateLength(msgBody, use7bitOnly) :
com.android.internal.telephony.gsm.SmsMessage.calculateLength(msgBody, use7bitOnly);
ret[1] = ted.codeUnitCount;
ret[2] = ted.codeUnitsRemaining;
ret[3] = ted.codeUnitSize;
Divide a message text into several fragments, none bigger than
the maximum SMS message text size.
- Parameters:
text text, must not be null.- Returns:
- an
ArrayList of strings that, in order,
comprise the original msg text - Hide:
com.android.internal.telephony.cdma.SmsMessage.calculateLength(text, false) :
com.android.internal.telephony.gsm.SmsMessage.calculateLength(text, false);
nextPos = pos + Math.min(limit, textLen - pos);
nextPos = pos + Math.min(limit / 2, textLen - pos);
if ((nextPos <= pos) || (nextPos > textLen)) { Log.e(LOG_TAG, "fragmentText failed (" + pos + " >= " + nextPos + " or " + nextPos + " >= " + textLen + ")");
Calculates the number of SMS's required to encode the message body and
the number of characters remaining until the next message, given the
current encoding.
- Parameters:
messageBody the message to encodeuse7bitOnly if true, characters that are not part of the radio
specific (GSM / CDMA) alphabet encoding are converted to as a
single space characters. If false, a messageBody containing
non-GSM or non-CDMA alphabet characters are encoded using
16-bit encoding.- Returns:
- an int[4] with int[0] being the number of SMS's required, int[1]
the number of code units used, and int[2] is the number of code
units remaining until the next message. int[3] is the encoding
type that should be used for the message.
Get an SMS-SUBMIT PDU for a destination address and a message
- Parameters:
scAddress Service Centre address. Null means use default.- Returns:
- a
SubmitPdu containing the encoded SC
address, if applicable, and the encoded message.
Returns null on encode error. - Hide:
boolean statusReportRequested, byte[] header) { spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
destinationAddress, message, statusReportRequested,
spb = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress,
destinationAddress, message, statusReportRequested, header);
Get an SMS-SUBMIT PDU for a destination address and a message
- Parameters:
scAddress Service Centre address. Null means use default.- Returns:
- a
SubmitPdu containing the encoded SC
address, if applicable, and the encoded message.
Returns null on encode error.
String destinationAddress, String message, boolean statusReportRequested) { spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
destinationAddress, message, statusReportRequested, null);
spb = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress,
destinationAddress, message, statusReportRequested);
Get an SMS-SUBMIT PDU for a data message to a destination address & port
- Parameters:
scAddress Service Centre address. null == use defaultdestinationAddress the address of the destination for the messagedestinationPort the port to deliver the message to at the
destinationdata the dat for the message- Returns:
- a
SubmitPdu containing the encoded SC
address, if applicable, and the encoded message.
Returns null on encode error.
String destinationAddress, short destinationPort, byte[] data,
boolean statusReportRequested) { spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
destinationAddress, destinationPort, data, statusReportRequested);
spb = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress,
destinationAddress, destinationPort, data, statusReportRequested);
Returns the address of the SMS service center that relayed this message
or null if there is none.
Returns the originating address (sender) of this SMS message in String
form or null if unavailable
Returns the originating address, or email from address if this message
was from an email gateway. Returns null if originating address
unavailable.
Returns the message body as a String, if it exists and is text based.
- Returns:
- message body is there is one, otherwise null
Returns the class of this message.
Returns the message body, or email message body if this message was from
an email gateway. Returns null if message body unavailable.
Unofficial convention of a subject line enclosed in parens empty string
if not present
Returns the service centre timestamp in currentTimeMillis() format
Returns true if message is an email.
- Returns:
- true if this message came through an email gateway and email
sender / subject / parsed body are available
- Returns:
- if isEmail() is true, body of the email sent through the gateway.
null otherwise
- Returns:
- if isEmail() is true, email from address of email sent through
the gateway. null otherwise
See TS 23.040 9.2.3.9 returns true if this is a "replace short message"
SMS
Returns true for CPHS MWI toggle message.
- Returns:
- true if this is a CPHS MWI toggle message See CPHS 4.2 section
B.4.2
returns true if this message is a CPHS voicemail / message waiting
indicator (MWI) clear message
returns true if this message is a CPHS voicemail / message waiting
indicator (MWI) set message
returns true if this message is a "Message Waiting Indication Group:
Discard Message" notification and should not be stored.
returns the user data section minus the user data header if one was
present.
Return the user data header (UDH).
Returns the raw PDU for the message.
- Returns:
- the raw PDU for the message.
Returns the status of the message on the SIM (read, unread, sent, unsent).
- Deprecated:
- Use getStatusOnIcc instead.
- Returns:
- the status of the message on the SIM. These are:
SmsManager.STATUS_ON_SIM_FREE
SmsManager.STATUS_ON_SIM_READ
SmsManager.STATUS_ON_SIM_UNREAD
SmsManager.STATUS_ON_SIM_SEND
SmsManager.STATUS_ON_SIM_UNSENT
Returns the status of the message on the ICC (read, unread, sent, unsent).
- Returns:
- the status of the message on the ICC. These are:
SmsManager.STATUS_ON_ICC_FREE
SmsManager.STATUS_ON_ICC_READ
SmsManager.STATUS_ON_ICC_UNREAD
SmsManager.STATUS_ON_ICC_SEND
SmsManager.STATUS_ON_ICC_UNSENT
Returns the record index of the message on the SIM (1-based index).
- Deprecated:
- Use getIndexOnIcc instead.
- Returns:
- the record index of the message on the SIM, or -1 if this
SmsMessage was not created from a SIM SMS EF record.
Returns the record index of the message on the ICC (1-based index).
- Returns:
- the record index of the message on the ICC, or -1 if this
SmsMessage was not created from a ICC SMS EF record.
GSM:
For an SMS-STATUS-REPORT message, this returns the status field from
the status report. This field indicates the status of a previously
submitted SMS, if requested. See TS 23.040, 9.2.3.15 TP-Status for a
description of values.
CDMA:
For not interfering with status codes from GSM, the value is
shifted to the bits 31-16.
The value is composed of an error class (bits 25-24) and a status code (bits 23-16).
Possible codes are described in C.S0015-B, v2.0, 4.5.21.
- Returns:
- 0 indicates the previously sent message was received.
See TS 23.040, 9.9.2.3.15 and C.S0015-B, v2.0, 4.5.21
for a description of other possible values.
Return true iff the message is a SMS-STATUS-REPORT message.
Returns true iff the
TP-Reply-Path bit is set in
this message.
This method returns the reference to a specific
SmsMessage object, which is used for accessing its static methods.
- Returns:
- Specific SmsMessage.
- Hide: