Friday, October 06, 2006

Developing for Japanese Phones in Netbeans (Part 2)

S!-Appli (Softbank) Development in Netbeans

In the previous post I explained a little about development of mobile applications for Japanese cellular phones. In that post I only touched development for Ez-Applis that are applications for Au(KDDI) phones.

In this post I will explain how to develop S!-Applis that are simply mobile applications for Softbank phones.

Some history

Before there was Vodaphone and the applications that ran on Vodaphone phones were called V-Applis. Developing V-Applis was exactly the same as any MIDLet using the Wireless Toolkit with the addition of the JSCL profile (J-Phone Specific Class Library). So in short a V-Appli was a MIDLet using the MIDP-1.0 plus a JSCL profile.

There were several JSCL profiles and different phones that supported those profiles. There was also an JSCL in steroids called MEXA (Mobile Entertainment eXtension API) that added some multimedia, sound and graphic capabilities to the phones. Here is a list of the phone models and the profiles they supported.

  • C4 Model Phones -> MIDP-1.0

  • P4 Model Phones -> MIDP-1.0 + JSCL-1.1.0

  • P5 Model Phones -> MIDP-1.0 + JSCL-1.2.0

  • P6 Model Phones -> MIDP-1.0 + JSCL-1.2.2

  • P7 Model Phones -> MIDP-1.0 + JSCL-1.3.2

  • S Model Phones -> MIDP-2.0

  • X Model Phones -> MIDP-2.0 + MEXA/JSCL


Each profile had it's own toolkit that you needed to download in order to develop V-Applis. These toolkits only contained the emulator binary and the JSCL jar file. To compile, preverify and pack the V-Appli you needed to use the Wireless Toolkit and Java Development SDK (> 1.3).

Vodaphone Japan was then adquired by Softbank and V-Applis were replaced by S!-Applis. All the V-Appli toolkits disappeared from the web and were replaced by the S!-Appli toolkit. Fortunatelly the only thing that changed was the name. Developing an S!-Appli is exactly the same as an V-Appli. The only differences is that the S!-Appli toolkit supports all JSCL profiles from JSCL-1.0.x to JSCL-1.3.2 profile.

I am unable to find the V-Appli toolkits in the web so this post will be about S!-Appli toolkit. In any case this toolkit includes all the previous profiles so the other toolkits are unecessary.

Getting the S!-Appli toolkit

The download page is here. Simply go were it says S!アプリ開発ツール and click were it says something like エミュレータ.

You will be asked to accept the copyright and term of use. Simply click where it says 同意する twice. You will have to fill a little form. The first two fields put your name, next your email address and finally select your development environment settings. In the next page click in the download link and you will get a file called S_Appli_Emulator_JSCL-1.3.2.zip.

Uncompress, run the installation exe and accept all the defaults. This will install the toolkit in the directory C:\S_appli_SDK_132. You can change this directory but make sure the path has no spaces in blank.

S!-Appli with Netbeans

All Vodaphone toolkits and the Softbank toolkit are UIE compliant so using them with Netbeans is a breeze. In Tools->Java Platform Manager in the menu of Netbeans press the Add Platform button. In the next panel select Java Micro Edition Platform Emulator and press next. In the next dialog all toolkits that Netbeans sees will appear in a list. If the Softbank toolkit is not in the list (most probably won't be) press the Find More Java ME Platform Folders... button and select the directory were you installed the toolkit (i.e. c:\). You will get the list of all toolkits installed in that directory. Simply check the toolkits you want added to Netbeans and press next.

Now in the Java Platform Manager in the J2ME section should appear the newly installed toolkit and that's it!! we are ready to develop S!-Applis.

Hello Softbank

Developing an S!-Appli is exactly as an Ez-Appli or a normal MIDLet. In the Netbeans File menu we select new project and select a Mobile Application as usual. Create the MIDlet you want and build/run from the project's context menu (right click).

Here is a little test MIDLet for a S!-Appli:



/*
* HelloSoftbank.java
*
* Created on 2006/10/03, 13:10
*/

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
*
* @author panama
* @version
*/
public class HelloSoftbank extends MIDlet {
public void startApp() {
Display.getDisplay(this).setCurrent(new HelloCanvas());
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}


public class HelloCanvas extends Canvas {

private final Font sFont = Font.getFont(Font.FACE_MONOSPACE ,Font.STYLE_PLAIN ,Font.SIZE_MEDIUM );
String s = "Hello World";

public void paint(Graphics g) {
g.setColor(0,222,100);
g.setFont(sFont);
g.drawString(s, (getWidth() - sFont.stringWidth(s)) /2,getHeight()/2,Graphics.TOP|Graphics.HCENTER);
}
}
}


There is a little problem that does not allow the excecution of the Emulator from within Netbeans. I am not sure if it is a problem of Netbeans or the Softbank toolkit . The problem seems to be that Netbeans gives the wrong path of the jad file to the emulator and the emulator complains with a "File not found" error.

The work around this problem is to change the "Running" properties of the project to give the correct path. To do this simply enter the project properties (right click) and select the "Running" section.

In the "Emulator_Command Line Options" text box write the following line. Making sure to change the paths to reflect your configuration:

-Xdevice:"S!_Appli_Universal_JSCL1_3_2" -Xdescriptor:"C:\path\to\project\dist\project.jad"

This way we can call the emulator from within Netbeans. The only disadvantage is that we must modify this configuration for each new project we create. Maybe future versions of Netbeans will fix this problem.

Final Notes

As we can see developing S!-Applis is not different than a normal MIDLet until we start using the JSCL classes. These classes allow us to manage the phone's hardware for example and with MEXA we get 3D graphics, 3D sound, etc.

Since the applications I develop must run in as many devices as possible I do not use the JSCL/MEXA classes nor the KDDIP classes that come with Ez-Applis. This way my applicatications can run with only minor modifications in au phones and Softbank phones.

If you are interested in using MEXA in your applications you need to download the MEXA SDK Ver1.1.0 from here. This SDK seems to come with a complete development environment and it is not recognized by Netbeans as UIE compliant. Maybe if someday I require to use MEXA for a project I will try to integrate it with Netbeans but is very unlikely to be any time soon.

Doja IAppli's

In the next part of this series of post I will talk about NTTDocomo's IAppli. An IAppli is different from Ez-Applis and S!-Applis because they do not use MIDP. IApplis use Doja and as MIDP there are several versions of Doja(1.0 to 4.1).

I will explain how to create Doja Platform Profiles for Netbeans and create a little test IAppli. If time permits me I will also try to point out the most important differences between Doja and MIDP that have caused me development headaches.

5 comments:

  1. Anonymous11:34 PM

    hey, netbeans detects the emulator but when we press next to install, if fails on all. why this is happening. can you please help me out with this.

    Thanks
    Jack Sparrow

    ReplyDelete
  2. Sorry but I no longer work with S!-Applis so cannot help you. All I can do is suggest you to use Netbeans 5 that works without problems or open a bug report at Netbeans.org about this problem.

    ReplyDelete
  3. Samuel11:34 PM

    Hello,

    Great, development looks simple enough... now I am wondering, how can I test the apps on my own SoftBank cellphone? Do I _have_ to register through all the crap at appget.com or is there some way of installing the apps directly on my own phone?

    Thanks for any insights :)
    Samuel

    ReplyDelete
  4. Hello Samuel,

    Unfortunately to add your applications to SoftBank phones you need to use the SoftBank servers and to do that you must be a registered developer that of course costs money. The company I work for is a registered developer so I had access to the SoftBank servers (in fact simple FTP servers) so I could test and so far I have not found any other way to put your applis in the phone.

    ReplyDelete
  5. Samuel6:51 PM

    Hello,

    Thanks for the reply! Oh well, too bad there is no other way.

    I finally managed to register to appget.com. Actually, appget.com costs nothing, but you cannot register if your work is for a legal entity like a company or a university. And once you have finished developing, they expect you to publish your work through their system.. I wonder why SoftBank does not provide the service themselves for free to everyone. I find it so silly... oh well.

    Samuel

    ReplyDelete