Friday, October 14, 2005

J2ME Wonderland

Been out of the posting loop for quiet a while. Found myself working on J2ME after about 6-7 months of hardcore BREW development last week. The whole time I spent on working in Java for mobile phones made me appreciate BREW even more. Its not the development environment or anything of that sort. Developing in Java is great, its the implementation of the JVM (KVM) on the handsets that sucks. I know the whole security, write once run everywhere routine but I feel Java draws the short straw when it comes down to cell phones.

BREW isn't perfect but it does give a developer a whole bunch of control over the flow of the applet. J2ME is sadly, very implementation dependent. Things that work flawlessly on a Nokia device will crash on Sanyo. Developing a MIDlet that in truly cross platform is an art that you learn from experience.

I learnt something new about the Security Architecture of Java MIDlets this week. On certain implementations the permissions to ask for in the MIDlet-Permissions: attribute of your JAD file are not exactly the same as mentioned in the JSR's.

For Instance, I kept getting a Security Exception while trying to access the camera on the device (JSR 135). I had everything in place. The MIDlet was signed and I was even asking for permission to capture frames from the camera.

I believe the specs on JSR 135 state that this is the permission to ask at install time but they don't mention that on certain implementations you might also want to also add permissions for other classes in a "protected package". This is the part that sucks, the specs on the JSR are too vague and give a lot of freedom to the implementers. This is good in a way cause the implementation of KVM on a device also has to take into consideration the device limitations and the carrier requirements but to a lowly developer like me .. it sucks big time. Had to add these permissions to the Jad file to finally get the MIDlet to run on the device (Thanks to some help from the Carrier support after 2 frustrating days)

For more info on the security architecture of J2ME : Article in Sun's J2ME section

No comments:

Post a Comment