Monday, November 7, 2011

Read text file on non JSR-75 phone

So my Samsung GT-E2230M does not support JSR-75 which is Java API on mobile devices that allow access to the device's file system such as the SD card. This mean any midp application in the phone can't  simply open arbitrary text files and also mean I can't use Opera Mini save webpage feature.

Searching around, I found EbookMe application that allow me to package a text files into a complete midp application to be installed on the phone just like any java apps on the phone. It a little bit cumbersome but at least now I have something to read while in waiting and away from my laptop and Internet connection.

Using it quite simple, provided you have Java properly setup on your system.
sh -Dname="Whatever Prog" -Dout=whatever whatever.txt
The unzipped tarball provide a wrapper script that you can run by simply passing the text file name as parameter. The -Dname and -Dout is optional to customize the name of generated midp app. The command would produce 2 files - whatever.jad, whatever.jar. You then transfer whatever.jar to your mobile phone and install it like a normal midp application.

Another limitation of the phone is it can't open anything more than 200KB. This mean for large text such as the free book The Art of Community by Jono Bacon I had to convert the pdf into text first and then use unix split to split it into multiple files.

Recently, I'd also found html2text python lib that allow you to convert any HTML page into text file formatted in markdown. This make reading the text on the small phone screen much pleasurable.

No comments: