Here’s an example of how the Android team are on the right track for developers. (OK I’m no Java fan boy, but it works and there are plenty of knowledgeable devs out there) For example, the android.telephony.gsm.SmsMessage class has lots of usefull functionality thats easy to access and use, look at these methods for example; (now I really want a real device)
| static | int[] | calculateLength(String messageBody) | |||
| 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. | |||||
| static | SmsMessage | createFromPdu(byte[] pdu) | |||
| Create an SmsMessage from a raw PDU. | |||||
| String | getDisplayMessageBody() | ||||
| Returns the message body, or email message body if this message was from an email gateway. | |||||
| String | getDisplayOriginatingAddress() | ||||
| Returns the originating address, or email from address if this message was from an email gateway. | |||||
| String | getEmailBody() | ||||
| String | getEmailFrom() | ||||
| int | getIndexOnSim() | ||||
| Returns the record index of the message on the SIM (1-based index). | |||||
| String | getMessageBody() | ||||
| Returns the message body as a String, if it exists and is text based. | |||||
| MessageClass | getMessageClass() | ||||
| Returns the class of this message. | |||||
| String | getOriginatingAddress() | ||||
| Returns the originating address (sender) of this SMS message in String form or null if unavailable | |||||
| byte[] | getPdu() | ||||
| Returns the raw PDU for the message. | |||||
| String | getPseudoSubject() | ||||
| Unofficial convention of a subject line enclosed in parens empty string if not present | |||||
| String | getServiceCenterAddress() | ||||
| Returns the address of the SMS service center that relayed this message or null if there is none. | |||||
| int | getStatus() | ||||
| For an SMS-STATUS-REPORT message, this returns the status field from the status report. | |||||
| int | getStatusOnSim() | ||||
| Returns the status of the message on the SIM (read, unread, sent, unsent). | |||||
| static | SubmitPdu | getSubmitPdu(String scAddress, String destinationAddress, short destinationPort, byte[] data, boolean statusReportRequested) | |||
| Get an SMS-SUBMIT PDU for a data message to a destination address & port | |||||
| static | SubmitPdu | getSubmitPdu(String scAddress, String destinationAddress, String message, boolean statusReportRequested) | |||
| Get an SMS-SUBMIT PDU for a destination address and a message | |||||
| static | int | getTPLayerLengthForPDU(String pdu) | |||
| Get the TP-Layer-Length for the given SMS-SUBMIT PDU Basically, the length in bytes (not hex chars) less the SMSC header | |||||
| long | getTimestampMillis() | ||||
| Returns the service centre timestamp in currentTimeMillis() format | |||||
| byte[] | getUserData() | ||||
| returns the user data section minus the user data header if one was present. | |||||
| SmsHeader | getUserDataHeader() | ||||
| Returns an object representing the user data header | |||||
| boolean | isCphsMwiMessage() | ||||
| Returns true for CPHS MWI toggle message. | |||||
| boolean | isEmail() | ||||
| Returns true if message is an email. | |||||
| boolean | isMWIClearMessage() | ||||
| returns true if this message is a CPHS voicemail / message waiting indicator (MWI) clear message | |||||
| boolean | isMWISetMessage() | ||||
| returns true if this message is a CPHS voicemail / message waiting indicator (MWI) set message | |||||
| boolean | isMwiDontStore() | ||||
| returns true if this message is a “Message Waiting Indication Group: Discard Message” notification and should not be stored. | |||||
| boolean | isReplace() | ||||
| See TS 23.040 9.2.3.9 returns true if this is a “replace short message” SMS | |||||
| boolean | isReplyPathPresent() | ||||
Returns true iff the TP-Reply-Path bit is set in this message. |
|||||