This application is currently at version 1.0.0 -- last update 24/Sep/2006.
Not long ago, I decide to provide the collection of funny quotes
and ASCII Art as webservices. So I have implemented a couple of
web services and provided links to them from the Fun Stuff section.
While a regular .NET or Java client for these webservices is trivial to implement (and therefore
would more than likely not interest anyone), a J2ME client can prove to be slightly tricky.
Hence this application.
Initially I thought about using the JSR for web services support in J2ME, but then I came to
realize that at the moment there is very limited support (it seems) for this in the current
range of handsets available on the market. Quite likely, this will change in (less than) a year
time, and then I might provide another version that uses the JSR. Meanwhile though, I decided
to base my application on the kSOAP package which is in fact contained in the application jar.
(You can read more about kSOAP at http://ksoap.objectweb.org/(link opens in a new window).
So if you are interested in how to implement a kSOAP-based J2ME webservice client for your mobile
or just want to have an application that gives you a funny quote every day/week/month/etc, feel
free to download and install this application on your mobile.
Note for the impatient users: Click
here to scroll down to the download link.
For the not-so-impatient ones, there are a couple of things you might want to know before
downloading the application and starting to customize it:
First and foremost, the application has been compiled using Wireless Toolkit 2.1 and uses
CLDC-1.1 and MIDP-2.0 profiles. If you are going to target a more recent phone you could
change this and compile it specifically for your platform.
Also note that due to the fact that it targets MIDP-2.0, if planning to deploy this
on an older phone (for instance, one that only supports MIDP-1.0), the application will
not work out-of-the-box. It is likely that you can adapt the code to work on this platform
but I am not willing to provide such backward compatibility as most of the phones that
I have encountered in the last couple of years support MIDP-2.0.
I have tried this application on a Nokia 6600 series and on Sony Ericsson 750i and W900i
and it worked fine. Due to the fact that it doesn't use any Nokia or Sony Ericsson specific
libraries/calls/etc, it should work fine on all the other devices that support J2ME. However,
if you find it to have problems running on your phone, please let me know by using
the Support Page. Please make sure that you select Report Mobile
Application Problem from the dropdown menu when sending such a message.
If you think the application is lacking certain facilities (quite likely) and/or you
have extended it to include such facilities, please feel free again to use the
Support Page to send me a message and I will get back to
you and find a way to incorporate such changes in the application.
Installing the Application
There are a few ways you can install this application on your phone. I would strongly
recommend that you download the jar file and then install it to your mobile
via Bluetooth, as the cost is zero doing it this way, however, feel free to use over-the-air
installation as well, but be aware that your network operator might charge you for the transfer.
Installing via Bluetooth -- If your mobile supports Bluetooth connections and
if you have a way to connect your computer to your mobile via Bluetooth (e.g. a Bluetooth
USB dongle), then you can use this method. The advantage of this method is that there is
that there will be no charge on your mobile for installing the application. Simply download
the application binaries, which are packaged in a jar file, to your computer.
(To download the binaries, go to the downloads section at
the bottom of the page.) Save the file on your hard disk as RandomQuoteClient.jar.
After the file has finished downloading, using your Bluetooth software tools (normally these
come with either the USB Bluetooth dongle, the operating system or with the phone) copy this
jar file onto your phone. At this step your mobile phone will prompt you whether
you want to install this application or not. Simply accept the installation and allow for the
software to be installed. Once installed, the stopwatch application will be stored on your
phone and you can use it any time you want. Please note that certain phones might take you through a few confirmation
steps during the installation process. Such steps are not described here and you should
consult your mobile phone manual for this. Also note that certain mobiles that have
a memory card/stick/etc will probably prompt you whether you want the application to be
saved onto your mobile memory or the memory card/stick. It is irrelevant from the application's
point of view where you install it and the application will work the same whether saved onto
your mobile memory or on the memory card.
Over-the-air Installation -- If you do not have Bluetooth support in your mobile
(unlikely!) or you do not have a way to connect your PC to your mobile via Bluetooth, and
you have internet access on your mobile phone, you can use this method to install the application.
Be aware that this method involves accessing the internet from your mobile
phone and your network operator will more than likely charge you for that.
However, if you have a certain download limit included in your contract, or the cost of
such download is rather negligeable, than you can proceed using this method. To use over-the-air
installation, using your mobile, navigate to the link (provided below)
to download the application descriptor. The application descriptor is a file
in a certain format that "describes" the application to the mobile, in order to allow the user
to see certain details and make up his/her mind whether s/he should continue with installing
the application. This descriptor file also contains the URL where the actual application
binaries (the jar file) can be downloaded from, should the user chose to continue
with the installation. So when entering the link in your mobile and navigating to it, your
mobile phone will download this file and it will prompt you with details about the application
and whether you want to continue with the installation. If you decide that you want to continue,
then the mobile phone will download the jar file that contains the application
and then take you through all the confirmation screens necessary when installing a Java
application.
Please note that the size of the jar file is about 46K, so the
download shouldn't take that long -- but then again, this depends on your connection speed.
To download the application descriptor the link is:
http://www.liviutudor.com/tech/downloads/RandomQuoteClient.jad (note
that this link is also given below in the Downloads section.)
Compiling the Application
If you decide that you want to modify the application, you will need to download the sources.
These are provided in the Downloads section below, packaged in
a zip file that contains the whole application project. I personally use
Eclipse(link will open in
a new window) and EclipseME(link will open in a new window) plugin to edit the file and
compile them. Obviously, these still rely on the presence of Sun's Wireless Toolkit (WTK)(link will open in a new window) so you will need to have this
installed as well. (As stated above, this project relies on WTK 1.1 and above,
so if you have WTK 2.0 or a more recent version, that will work just as well.)
Due to my using Eclipse, the project included in the zip file is an Eclipse project, however,
I am sure it's easy to create a project file for any other IDE that uses WTK.
To edit/change/compile the application simply download the zip file provided below,
then unzip it in a folder (keeping the directory structure) and then point Eclipse to that directory
when creating a new project in Eclipse. Building the sources should be done automatically every time
you change the file (well, at least that's the way I've set up my Eclipse instance). Once you are
happy with your application, simply right-click on the project itself in Eclipse and select
J2ME --> Create Package -- this will create a jar and a jad file
in the deployed directory which then you can upload on your mobile. Important note regarding compiling the sources: Please make sure
that when you compile the sources, the .class files are generating using compliance
level 1.1, as J2ME is still JDK 1.1 compatible! Setting your compliance level to a higher
value (e.g. 1.5) will create code that your mobile cannot run.
Customizing the Application
Since the application is quite basic, there isn't too much to customize. You can edit the source
files I guess and remove the reference to my website but in terms of appearance that's pretty
much it, I guess.
Of course, one can take the route of writing a more "fancy" Form-derived class
which will have more appeal to the user -- feel free to do so and email me the code if you
are really concerned about the look of the application; I'd be happy to plug that into the
code and give you credit for it.
One thing you could change though if the application shows some "strange" characters inside the
funny quote returned by the web service, is to change the parameter called useNewLines which
is passed to the webservice. If you check the documentation provided in the Fun Stuff Section
you will find out that this parameter requests to the server that the special HTML tags like
<br/> are converted into new line ASCII characters (i.e. \n). By
default, we request that the quotes returned have this special tags converted to new line, as most
devices nowadays "know" how to handle the new line characters and will properly break the text
and start a new line. However, if your device doesn't support that, you can change this value
in the constructor of RandomQuoteClient class, when we call call.addProperty
and change the Boolean object created to false -- the returned text will
no longer contain new line characters (so it will not break the lines properly), but at least you
will get rid of the "strange" characters shown instead of \n.
History
The current version of this application is 1.0.0 and as it stands at the moment I
am not tracking previous versions to that. It's very likely that if I decide to maintain this
project in the future I will only keep the latest version, however, if at some point I will
provide downloads for previous versions as well then the Downloads section below will contain
links to all the previous versions of the project.
Download the application (jar). Download the application descriptor (jad)
-- please note that this usually will also kick off the process of downloading the actual application
if you access this link from your mobile. Download the application project (binaries and source code).
Read our download disclaimer.
Note that this application is also hosted on getjar.com, so if you
prefer you can download it from there, by using this
link(link will open in a new window).
Interesting site about getting Londoners chatting during their daily commute
I Can Talk, Me!
Liviu Tudor's mobile applications
download free J2ME mobile applications
download the source code for J2ME mobile applications
J2ME mobile applications for Sony Ericsson and Nokia phones
technical tips programming Java java j2me mobile knowledge base
request a J2ME mobile application