| |||||||||
| |||||||||
|
A Basic guide to developing i-appli programs by Zev Blut (2002-8-14)
Welcome. Before we start you will some times see me use the term keitai, this is a commonly used Japanese word that is often used to mean a mobile phone. Actually keitai means portable and the full term for a mobile phone is keitai denwa, but it is often shortened to keitai. So, when you see keitai I mean a mobile phone. The difference between i-appli and Sun's MIDP profileNTT DoCoMo decided that they are not going to use Sun's community developed profile API MIDP. They say something to the nature that the MIDP is also for things like pagers and thus NTT DoCoMo's API is better optimised for their phones. Surprisingly enough the API's themselves are actually fairly similar.
As to which API is better? I have my opinions, but I will not bias you yet. = ) Needed Tools
Generating and Running an i-appliSo you have created a class that overrides IApplication and you are ready to test it, and deploy it! I took the easy way out and compiled everything within Forte, having my classes in a mounted directory and then the iEmulator/or iJavaEngine classes mounted also. Of course, you can always compile from the command line of java just make sure that the bootclasspath has the cldc java libraries and that your classpath also contains the i-jade/iEmulator/iJavaEngine and your classes. Actually, I recently encountered a problem when preverifing my classes that were compiled from the very basic Forte environment. It seems that my simple way of compiling actually used the fully Java classes and thus inserted a few illegal classes in my classes. So make sure that you set up your environment to compile only with the CLDC classes and the NTT DoCoMo classes! At this point I would say that it is best to use the i-jade simulator
to test out your class. You can do this by going to the command line
and typing something like this
You will then see two windows appear one with a replica image of the 503 keitai
and the other is a control window in Japanese. Really the control windows
commands are so simple that you do not need to worry if you cannot read
Japanese. Simply select the very first menu item of the first menu to select
the IAppli class or (jam file) that you want to run. The Cell phone will then
start your application and you can test it from there. The second menu item
is the quit option and the second menu is simply the about window. In the
control window you will also see the path of your currently loaded class or jar
file. If you loaded it from a class you are going to need to replace the
backslashes (or forwardslashes) with periods of the package name of your class
so for example
Now if you tested it and you are ready to try and deploy your program onto a real phone you need to do a few more things.
GotchasAlso watch out for loading resources in the MediaManager class, make sure you have 3 slashes such as "resource///me.gif". When going to sites use the name versus the IP address of the site. Or else the i-appli will not download. You can use relative URLs in the Web Page and the jam file, just make sure you are not moving them around too much! I would say that the relative URLS are actually more preferable. The i-appli menu has a good function that lets you get the latest version of your IApplication so it uses the jam file and extra info it recors to find your site and check for new revisions. Additional InformationHttp ConnectionsFirst important piece of information is that if you want to make a Http connection, to up/download information from the originating server you must add to your jam file the "UseNetwork = http" flag. If you do not add this, most likely everything will work fine on your emulator and when you download the program onto a real phone and run it, as soon as you actually call the code that makes the connection you will get an error message and the program will quit. Also, if you are using ssl over http (https) then you still say http. I have not yet tested this, but the docs say that this is the case.Dates in Jam fileSo if you have read my warnings about jam files and you created them very carefully and you are still having problems, then this information might be of great help. Well you must be very precise when you enter your data for the LastModified field. It must start with the first three letters of the day of the week, thus Monday is Mon, Tuesday is Tue, Wednesday is Wed and so forth. Then you have the comma and the date of the month this must be 2 digits so if it is the second of the month then it is 02 not 2. I have not tested the month part yet, but I believe that the month must also be the first three letters of the month January becomes Jan, Febuary becomes Feb and so on. Then you have the year which must be 4 digits and then the 2 digit hours colon 2 digit minutes colon 2 digit seconds. If you do not follow this format, then the phone will give an error when attempting to download the jam file and thus prevent you from downloading the jar file and running the program. So the format is something like this LastModified = ABC , ## ABC ##:##:## , where ABC means 3 alphabetical characters, and the # symbol means a number.Graphic performanceIf you want to improve the graphic performance of your application, then
when using the Graphics object before performing the operation call the lock method. Thus if your Graphics reference is called then you would do something like this g.lock() when done you call g.unlock(false) or true if you want to force the graphics to be flushed instantly. False means to put the Graphics a queue and to draw the Graphics when its' turn comes. This allows for double buffering and the reduction of screen flashing and such.
ColorsThis is something that got me for not reading the docs carefully. The Graphics have a few colors declared as constants. At first I thought Ok so if I want to draw a yellow line then I will call g.setColor(g.YELLOW) then g.drawLine(0,0,100,100) . Of course, I was wrong! You must call g.setColor((g.getColorOfName(g.YELLOW))) HistoricalNote: I just went to a Sun Tech Day conference about MIDP programing yesterday (Feb 7th) and the presenter said something that caught my interest. She said something to the nature of running MIDP on i-appli phones. So I had to ask her if she knew that they are currently different. She said that since i-appli are the first (or someof the first) java enabled phones they did not have time to get up to spec with MIDP. So she is hinting that maybe the next generation or two of i-appli phones will actually go over to MIDP. Of Course, if you look at NTT DoCoMo's FAQ site about i-appli they seem to have a different stance. Interesting nonetheless. Summary
Links
Here are a few links for information about J-Phone and KDDI's Java properties. Sorry most of it is in Japanese, But you should be able to find the Java information. JPhone KDDI | |||||||||
| |||||||||
|
Copyright © 2006 RimLife Technologies LLC All Rights Reserved. Java, Java ME (J2ME), are the trademarks of Sun Microsystems Inc. Legal Stuff | |||||||||