June 04, 2008 Two things that go well together: Web Runtime and Java Posted by Gorkem Ercan at 09:12 PM | Categories: Development

Web Runtime and Java makes a delicious combination. They are the milk and cookies of S60 runtimes, tasty when consumed alone but delicious when together. Why should not they be, Java provides access to almost all the local device features today and web runtime brings all the goodness of the Web 2.0 applications and web based UIs.

I know you think that Java and Web Runtime does not have any built-in interoperability today, and this is almost true. So what is the catch? How can you create a widget that uses java APIs?

Starting with the S60 Feature Pack 2, java runtime introduced the new UI toolkit for Java, namely eSWT. eSWT includes an amazing component called Browser. Browser is one of the ~40 components of eSWT and its purpose is to provide access to the platform's native web browser. In our case, this is the S60 Browser Control. Using eSWT's Browser you can embed a browser into your Midlet. The end result is a Midlet that hosts S60's WebKit based Browser. Although it is not the purpose you can actually create your personal Browser with it, there is is a simple example on Forum Nokia wiki demonstrating this.

So what is the web runtime connection? Just like eSWT's Browser, the heart and soul of Web Runtime is S60 Browser. When eSWT initializes its Browser component, eSWT pretty much enables similar functionality to Web Runtime. As a result, all the AJAX programming available with Web Runtime is available but this time embedded inside a Midlet. Of course being embedded into a Midlet has advantages. Your web widget can now access all the local resources, use APIs like location and PIM and generate the content with the help of these Java APIs and set it to the Browser. It is even possible to mash up the local data with the online services, (Google Maps, Flickr etc.)

Permalink | Comments (0) |

Back