Nokia 5800

Nokia 5800

Is Symbian going to make it on mobile devices? I’ve used java a long time now and hoped the fragmentation would be sorted out for by now. My first experience with S60 was pretty shocking. Sun’s SDK for wireless devices is actually really good, but runs on the emulator generally won’t on the actual device. It is a very slow and painful debugging process to test on emulator, then create a SIS (or jar files) and upload to the phone, run it and watch it crash. No way to know were or why, and you need to get the stack trace yourself (display on a Form, or send to a file etc). Ugly, and in many devices the standard Bluetooth API (JSR82) will fail to connect because the phone’s firmware is locked. Pretty bad news for a developer trying to sell innovative apps.

Now, The fragmentation is in both directions. More handsets and new code tools all the time. Python is better at some of the portability and debugging. It is very easy to use a Bluetooth Console to execute commands directly on the device. But not all devices are supporting Python. Flash and Brew on devices also seemed promising. Brew bundles the billing/purchase and digital signing right into each app. Seems like a good idea for developers, but has been buggy and does limit how you can deploy your application. Now don’t forget JavaScript. JavaScript has done well and is on many platforms and almost every web browser. iPhone heavily leverages JavaScript and has shunned Flash and JVM’s despite the rumors of Apple supporting both soon. So, pick a device and one or two code tools? Not an easy thing to do because you also need to consider what App Store is going to get you into the market.

(not even going to talk about C/C++ because it just needs to die. in my opinion, only the firmware for each phone should be native. Note that much of Nokia’s SDK required elaborate configuration to write even simple apps for S60)

For many of these reasons I would strongly suggest phone gap. They have an Open Source Project to try to address these problems and are going to do well just because developers need to be able to churn out apps quickly. No bluetooth support yet, but watch out for it.

Now, what about all my Java code I have thus far? Well, Nokia isn’t totally asleep at the wheel, it just seems like it. But they have updated their Java Runtime for S60 to version 2.0. It is way better and solved many of platform issues on my Nokia 5800.

Worth watching out for is an Open Source Os called MAEMO. If this project replaces all the Nokia legacy stuff and gets traction.. They might be able to get in the game. Seeing how Android does on some of the lower end phones will tell the tale. Android has a way better App Store and a great Eclipse plug in. Looks like a horse race, place your bets.

, , , , , , , ,

ok, few links to errors I’m seeing thus far:

Future Exception is a new one! This error only started after I re-flashed my Nokia 5800 with version 21 of the firmware.

I used to get further, the URL was discovered from the service search and I’d even get asked for permission to connect… and then get This error

Again, my code is freely available to test your connection issues, but here is a snip. Notice that the URL is false for master, encrypt and for authenticate. This code is actually part of the ZephyrOpen Project for PC and MAC, but being JSR-82, this is supposed to work on the cell phones too.. and it does, just need a Black Berry 8100, that junk phone has never let me down with Devopment tools. Too bad it has no WIFI, could be used as a BT to WIFI bridge.

why does Word Press Mangle this code?

/**
* Find and attach to serial port profile for this device
*
* @return true if connection was established, false if not
*/
public boolean connect() {

if( ! findService()) {
constants.error(“can’t find serial port service on ” + getBluetoothAddress(), this);
return false;
}

try {

constants.info( “url = ” + serviceURL, this);

/** open the serial port streams */
connection = (StreamConnection) Connector.open(serviceURL);
inputStream = connection.openDataInputStream();
outputStream = connection.openDataOutputStream();

} catch (Exception e) {
constants.error(“connect(): ” + e.getMessage(), this);
return false;
}

/** all is well, streams open */
return true;
}

/** @return true if target device was found */
private boolean findService() {

constants.info(“Searching for SPP ” + getBluetoothAddress(), this);
serviceSearch = true;

/** Serial Port Profile UUID */
int[] attributes = { 0×100 };
UUID[] uuids = {com.intel.bluetooth.BluetoothConsts.RFCOMM_PROTOCOL_UUID};

/** look for serial port service */
int serviceSearchID = 0;
try {

serviceSearchID =
agent.searchServices(attributes, uuids, this, this);

/** spin lock */
while (serviceSearch) Thread.sleep(DELAY);

} catch (Exception e) {
agent.cancelServiceSearch(serviceSearchID);
return false;
}

/** found target serial port profile ? */
if( serviceURL == null ) return false;
else return true;
}

/** found a service on this device */
public void servicesDiscovered(int arg0, ServiceRecord[] servRecord) {
for (int i = 0; i < servRecord.length; i++) {

DataElement nameElement = (DataElement) servRecord[i].getAttributeValue(0×100);
if ((nameElement != null)
&& (nameElement.getDataType() == DataElement.STRING)) {

/** retrieve the name of the service */
String name = (String) nameElement.getValue();

if (name.equals(“Bluetooth Serial Port”)) {
serviceURL = servRecord[i].getConnectionURL(
ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
serviceSearch = false;
}
}
}
}

, , , , , ,

Ok, more on java on mobile devices. There has been some long delays using java on S60 when really, this shouldn’t be difficult to port code from mac to cell phone if it is all pure java? Read my “Batman Phone Review” to see the first round of driver issues with this phone.

After finally getting the Flashing Cable (CA-101) to work the firmware upgrade on the phone only took a few minutes. This with the latest version of the OVI suite (v1.1.3) the bluetooth synchronization worked much better and the cable was not needed, but the Nokia Launcher did cause crashes on several occasions were my software was using the bluetooth (WIDCOM) stack at the same time. That I can live with, but the cable driver now shows up as two devices in the PC Device Manager and yes, that causes the flashing cable issues!


Notice that on the development side of things that the S60 Emulator is slow to launch and I’ve not been able to use it from Eclipse! Only thing you can do is to build your JAR files and then open them with the Nokia S60 Emulator.

The crazy, maddening thing here is that the Nokia Firmware is sooo hit and miss as to what java calls will work, and which ones will return errors or just have when running on the phone, even though the exact same code runs fine on the emulators. See Below for the errors launching S60 Emulator from Eclipse:

So, in terms of any code advice for the nokia phones? I have had much better time with S60 Python Libraries. The ability to basically telnet into the phone and run commands from OSX has been dreamy and what initially made the phone attractive — FAST DEVELOPMENT. Looking at JavaFX and NetBeans.. more of the same, but very nice tools to mash together a MIDlet.. but good luck if you get stuck. Long story short.. I’m praying for better Dev tools from Nokia or Sun., but the promise of “write once, run anywhere” turned out to be one of those great ideas that never happened.. Maybe Python is the answer? (Or Maybe choose higher end phones like Apple or Google for your fast tracked app you want to sell online.)

You can test this on your phone by installing the MIDlet test Tools I’ve posted on my Google Code Site Please try these simple apps on your emulators and devices and see what works and what error codes you get. I’ll write about Bluetooth issues like service advertising and discovery next week.

, , , , , ,

OK, some nerd rage ahead, but also few tips on JavaME development.

Long story, but the ZephyrOpen code project was first running on chips as meager as the TINI java chips. Growing power and java support on cell phones made these boards obsolete for my needs while Rock Climbing. So, now a mid range cell phone has everything I need up there, including a video stream. (original system, batteries and camera) But, not an easy choice these days, new phones coming out almost weekly (and the new LG phones look great too and have extremely good cameras ).

Not one mobile device has it all, but some are better at blue tooth and java support. Others are just development headaches waiting to happen (code, compile, transfer the jar files and test — too long a proccrss to be effective programming time). The “write once” promise of java didn’t come true. The fragmentation was unavoidable even with the JSR’s, but it is still way much more portable re-usable than C/C++ code. For my needs I had to get a phone with solid bluetooth and WIFI. I also needed an App Store to eventually offer services via an Open Source App.

Easy right?

I fumbled around on a Black Berry (has a good market place also) for a few weeks. Tested my app and all was working, but I hated the 8100. I had to get something could actually type on. Mind as well get GPS and all the other cool sensors like accelerometers and such while I’m at it. The Iphone has great App store, but *was* blocking bluetooth access and serial port access. The new G1 also had bluetooth API problems (but has a brand new App store). So really my only option was good old Nokia. They have been around longest and have large developer base and support. I liked every Nokia device thus far, so…

… get the “Bat Man Phone” then.. it has what I need, and will let me test out all the interesting Python libraries I’ve been reading about. The 5800 is not offered by the cell companies in Canada yet, so needed to get it early from NCIX. All I can say is that I’ve never installed, re-installed and done it all over again to get a software update… and I’m still not able to get my XP box to connect to my phone. (I do get USB access to the memory card to transfer files, so the cable is fine). You need to upgrade the firmware and setup the Music, Maps, Photos and OVI. Without this update, good luck installing Python and any of the new accelerometer games!

Ensure you have the version 20 of the firmware, I had to RMA my phone and stop coding for over a week. Now that I have version 20, I still get errors trying to install python for S60.

Few links to get started developing for S60 here (this is what sold me on Nokia):

LWUIT (“mobile versdion of swing “)
S60 Sensor Framework
Java Libraries and Documentation
Getting started with J2ME

Very disappointing from one of the biggest players n the business. A USB and driver issue.. gimme a break. My crappy BlackBerry 8100 will sync on the PC without fail (and even from ANT or Command line no less) I went with Nokia because they have been around a long time and allow you to unlock the phone free of charge. But.. remember that Nokia has many, many version of hardware and software out there.. this fragmentation just might be their Achilles Heel. Watching Polar and Nokia join forces in heart rate devices was a big news in the industry, but I am hard pressed to say anything good about these two giants — save for that fact that they both have the lion’s share of the market.

You can follow more of this screw up on engadget. I’ll get the python and other apps going on it soon, just rather be coding than futzing about.

But, what is good on the phone you might ask? Well, the MIDP support and bluetooth are solid, and that is what I bought the phone for after all. The emulated buttons for the old school phones is also good. The GPS is ok, but I’d use an external receiver for anything really important like climbing. Screen and typing is not bad either, and I’ve got almost no hand function, so.. that says something. I use my thumb nail mostly, so the resistive screen is fine for me. (but iPhone’s capacitive screen still wins on this score)

Finally, the camera quality is pretty good for video too. Here is a clip from the first quad rugby games to be held in the new Olympic skating oval in Richmond BC.

, , , , , , , , ,