Friday, July 1, 2011

Cross platform development with Enyo

I have been looking to use HTML5 for cross platform development on mobile devices and have probably tried just about every framework going and they all suffered from different problems from not handling screen resolutions to not supporting touch to not being mature enough. Today I managed to get access to the Enyo framework which is part of the WebOS 3.0 SDK.

I wont go into the details of the framework just now, but I went through the tutorial to create a simple feed reader app. I used Aptana to develop the application and debugged it using the Chrome browser. Once I had the App developed I used the Palm command line tools to throw the app onto the WebOs Emulator. You can see both browser and emulator running the same app below.


Everything works quite well and I decided to try my luck at running the same app on my Android G2 phone. In Eclipse I created a PhoneGap application and replaced the web asset directory with the same app structure as for WebOS version. Before I could run the app I needed to copy the Enyo runtime onto Android. This is not a small framework but was easily installed on the SDcard via USB. Then the only modification I needed to make was in the Index.html at the point where it pulls in the Enyo framework. In my case it went from:

<script src="..\..\..\..\Program Files (x86)/HP webOS/SDK/share/refcode/webos-framework/enyo/1.0/framework/enyo.js" launch="debug" type="text/javascript"></script>


<script src="content://" launch="debug" type="text/javascript"></script>

Then I used Eclipse to install and run the app and voila


It ran great, the performance wasn’t as snappy as I would have liked it but certainly very useable. The App scales very well from the large screen to the small. So far this looks like the most promising cross-platform HTML5 solution I have used so far. Now I have the process down I am interested in how far I can push this framework. Hope to post more on this. I am also interested if Enyo would run on iPhone/iPad. As I don’t have the development environment for that I would be interested to hear if anyone else has tried it.

Sorry for the short post, but it is friday evening and I need a beer Smile

Edit 7/5/2011

After a bit more hacking around in the Enyo API I have found a couple of areas which don’t work in a cross platform manner. This perhaps is not surprising since Enyo was never released as being cross platform in any way. The areas that would affect any application where the desire was to run on more than just Palm devices relate to the specific environment and user interface of those devices. I have found three such areas so far:

  • Services: Enyo provides access to a number of pre-defined services on the Device some of these work (e.g WebService) across platforms but the PalmService is specific to the device and does not exist on other platforms.
  • AppMenu: This one is a little trickier since it affects the UI portion of the Application. Although most platforms have the concept of an Application menu the AppMenu component does not travel well off the device. There is a mechanism to deploy it in a desktop browser (by pressing CNTL `) but I certainly could not find the equivalent on Android to make it appear and it certainly is not bound to the existing menu button on my G2.
  • Handling Back: This can easily be done by providing an application specific back button but a number of devices have an existing back button. Frameworks like Jo and JQM recognize this and provide support based on the platform capabilities. Enyo ignores the back button on Android device which makes it hard to use in multi-view applications where the learned action is to press the back button.