I am new to J2ME application development. Normally I have developed j2me apps for Nokia phone s60 series and in PC using emulator(with Netbeans IDE). I think that emulator has Nokia infrastructures to run mobile apps.
When I tried to run the same simple j2me application which ran on a Nokia phone, on a Sony Ericson, Motorola, it did not work. I have heard that j2me apis are little bit different phone Vendor to Vendor. Will I have to use Sony Ericson and Motorola J2ME API and develop separate app for each brand? Cannot I use a common J2ME api for all mobile phones? Or any solutions to use a common api for all mobile phones. (The application features can be limited to the phone's performance, version, series and its support. It is ok. Here my question is about a common api. My question may be similar to can we develop a j2me application that work in all mobile devices. But I couldn't find good answer.)
2 Answers
As long as you used packages which are strictly part of the J2ME Framework you should not have any issues. You need however, to keep an eye out for the MIDP and CLDC version that the phone supports.
Different MIDP and CLDC versions provide you with different apis, running a piece of code designed for MIDP 2.0 on something which does not support it will eventually cause errors. Maybe this Oracle Page will help you solve any queries you might have.
Take a look on J2MEPolish. This is very large library that should provide level of abstraction between the application developer and the concrete platform. But it takes some time to learn it. Probably easier way is just to refer to the concrete phone documentation and use only JSRs that are supported by concrete model. There is a trick that allows you to check that concrete JSR is supported. You can call Class.forName()
for some class from specific JSR. If exception is thrown JSR is not supported. The advantage of J2MEPolish is that it helps you to generate version per device type.