File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes How to Compress TextMessages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "How to Compress TextMessages" Watch "How to Compress TextMessages" New topic
Author

How to Compress TextMessages

Umashanthi Pavalanathan
Greenhorn

Joined: Feb 15, 2007
Posts: 18
Hello,
I want to know how to compress and send a large amount of characters in one SMS and how to read the compressed SMS from the receipent's phone.
If you have any idea please share yours...
Thanks in Advance,
Umashanthi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42922
    
  68
SMS are limited to about 160 characters, so I don't think you'll be able to send a "large amount" of text.
Umashanthi Pavalanathan
Greenhorn

Joined: Feb 15, 2007
Posts: 18
Hi Ulf Dittmer ,
Thank you for your reply.
But I heard that we can compress & send SMS having more than 160 characters in one SMS using JavaME.
But I am not sure.
Thanks again,
Umashanthi
Eduardo Marques
Ranch Hand

Joined: Feb 19, 2005
Posts: 231
A SMS message may be encoded in a long SMS using different SMS segments.
The WMA specification states that at least 3 segments must be supported by an implementation, which gives, depending on the encoding:

GSM-7 bit (ASCII 7-bit) : 435 chars
Binary data (ie binary messages): 400 bytes
Unicode text: 198 messages

See page 28 of appendix A of specs at http://jcp.org/aboutJava/communityprocess/final/jsr120/index2.html.

You can query the number of segments in a SMS message, by using the following code:



Cheers


Eduardo Marques
Get ready for your SCMAD certification at J2MECertificate.com - See what all the buzz is about ...
Eduardo Marques
Ranch Hand

Joined: Feb 19, 2005
Posts: 231
But note that a device may support more than 3 segments, so these values are minimum guaranteed bounds ...

I doubt however that you may be able to send more than 500 to 1000 chars, so it's wise to compress your data somehow.

Also, use BinaryMessage, not TextMessage if your data scheme does not require text information. The character set in use by the phone (eg if Unicode) may decrease the message capacity heavily.
Sayan Jaipan
Greenhorn

Joined: Jun 05, 2002
Posts: 3
Use GZip library to compress text string then set payload text with that compressed string.
Receiver need to install a client that support unzipped text message.(J2me + specific port, symbian + native sms inbox)
[ July 29, 2007: Message edited by: Sayan Jaipan ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Compress TextMessages