Sunday, June 26, 2011

webOScapades -- Occasional Adventures in webOS Development

I make no bones about it, I like HP's (nee Palm's) webOS platform. The operating system is beautiful, the community is incredible, and the development process is a charm.

The power of webOS lies in the use of web technologies. You can build a quality app with nothing more than HTML, CSS and JavaScript. Web programmers will be right at home. For webOS 1.x and 2.x, you generally needed to learn an MVC style framework called Mojo. Mojo is old news -- starting with webOS 3.0, the new hotness is Enyo. The Enyo SDK is currently under NDA in the HP Early Access Program, but will be presumably be publicly released in the near future when the HP TouchPad ships on July 1st, 2011.

I'm not walking the Enyo road just yet. Right now, I'm having much more fun playing with PhoneGap, a cross-platform framework that allows you to write HTML/JavaScript apps and author them on multiple platforms. As of version 0.9.5, PhoneGap is Mojo-free. You write just as you would for a standard web page and include a little PhoneGap JS code. The best way to get started would be to download the latest version of PhoneGap (0.9.5.1 at this writing) and delve into Herm Wong's excellent webOS PhoneGap tutorials. His "Getting Started with PhoneGap WebOS 0.9.5" post is a good place for beginners, and includes links to other needed steps.

Becoming a webOS developer couldn't be easier -- or cheaper, for that matter. It's free. As in zero, zip, nada. Just sign up at the HP webOS Developer Portal. Community accounts will give you access to play around with the SDK and post in the forums, but you'll need a Developer account to publish apps in the App Catalog. For that, you need a PayPal account (to get paid) and a business tax id number (to pay the government).

By itself, PhoneGap isn't enough to make a quality webOS app. You need to add the functionality in bits and parts. As I discover more pieces of the puzzle, I'll put together posts and tutorials on the process. This blog will hopefully be an aid to others on the same path.

Ken Schreihofer

15 comments:

  1. Do you know if is possible use Enyo + Phonegapp? I am not sure... but i think that will work without any issue... I like the blog! nice. Congrats.

    ReplyDelete
  2. El Cabe,

    Thanks, glad you like it! That's an excellent question. I can't go into too much detail since I'm still under NDA, but the short answer is yes -- since Enyo is just a JavaScript framework, it works with PhoneGap quite handily. Once the NDA is lifted, I'll make a post with code and screenshots.

    ReplyDelete
  3. I tried to start developing with phonegap. But I got an error in cygwin
    .. "palm-package: command not found"
    .. "*** [package] error 127"

    I already deinstalled, reinstalled Palm SDK.
    Also added PATH to my vars (PALM SDK bin folder..)

    What else could I do?

    ReplyDelete
  4. You don't need to use phonegap's make to package a webos app. You can simply just palm-package the framework folder.

    ReplyDelete
  5. I normally run PhoneGap on Linux, so I just went through the install process on Windows XP. I ran into the same palm-package problem that you did while using the makefile. The solution I found was to run the commands separately:

    1. Within the webOS directory, run "palm-package.bat framework" (minus quotes)

    2. Whatever ipk was generated in step one (named in your appinfo.json file), use here: "palm-install.bat com.whatever.something_0.0.1_all.ipk"

    3. Then "palm-launch.bat com.whatever.something"

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Still don't work, also with the alternative way.
    Now he claims that java need to be installed.

    See below all steps:

    "MASTER@SAT /cygdrive/d/phonegap/webos
    $ make
    mkdir -p lib
    rm -f lib/phonegap.js
    cat js/phonegap.js.base >> lib/phonegap.js
    cat js/acceleration.js >> lib/phonegap.js
    cat js/accelerometer.js >> lib/phonegap.js
    cat js/application.js >> lib/phonegap.js
    cat js/audio.js >> lib/phonegap.js
    cat js/camera.js >> lib/phonegap.js
    cat js/contacts.js >> lib/phonegap.js
    cat js/debugconsole.js >> lib/phonegap.js
    cat js/device.js >> lib/phonegap.js
    cat js/file.js >> lib/phonegap.js
    cat js/geolocation.js >> lib/phonegap.js
    cat js/map.js >> lib/phonegap.js
    cat js/mojo.js >> lib/phonegap.js
    cat js/mouse.js >> lib/phonegap.js
    cat js/network.js >> lib/phonegap.js
    cat js/notification.js >> lib/phonegap.js
    cat js/orientation.js >> lib/phonegap.js
    cat js/position.js >> lib/phonegap.js
    cat js/service.js >> lib/phonegap.js
    cat js/sms.js >> lib/phonegap.js
    cat js/storage.js >> lib/phonegap.js
    cat js/telephony.js >> lib/phonegap.js
    cat js/window.js >> lib/phonegap.js
    cat js/windowproperties.js >> lib/phonegap.js
    cp lib/phonegap.js framework/phonegap.js
    palm-package framework/
    make: palm-package: Command not found
    make: *** [package] Error 127

    MASTER@SAT /cygdrive/d/phonegap/webos
    $ java -version
    java version "1.6.0_26"
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
    Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)"

    Weird. Help! ;)

    ReplyDelete
  8. [after ERROR 127...]

    MASTER@SAT /cygdrive/d/phonegap/webos
    $ palm-package.bat framework
    error: 64-bit java is required.

    [then java-version]

    (sorry for spam!)

    ReplyDelete
  9. Huh. Are you running a 32 or 64-bit system? Launch IE, go to Help>About, and let me know if it says 32 bit edition or 64 bit edition.

    One of a couple of things might be happening: maybe you're running a 64-bit system and installed the wrong version of Java, or running a 32-bit system and installed the wrong version of the SDK. If you're running 64 bit, just install the 64-bit version of the latest JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html (jdk-6u26-windows-x64.exe).

    ReplyDelete
  10. Finnaly worked. deinstalled the 32bit one.
    Thanks alot!

    Now I can continue creating apps ;)
    Thanks alot.

    If you want you can easily delete my comments to clean here up.
    Blog bookmarked.

    ReplyDelete
  11. Glad you're up and running! I have no problem leaving your comments -- who knows, maybe someone else with the same problem will find their answer here. Keep your eyes open for new content in the coming days.

    ReplyDelete
  12. I'm having the same problem with " palm-package" the command is not found , how can I set the path of this batch file in cygwin? :S

    ReplyDelete
  13. Hi Moyado,

    The path is set via your system's environmental variables, see http://support.microsoft.com/kb/310519 for more information. You want to add the path (c:\abc\def) that leads to the "bin" folder of wherever you installed your Palm SDK.

    Is the problem that you're not able to use the make script, or that the palm-package command doesn't work? Try the solution that I posted a few comments above, entering the commands separately:

    1. Within the webOS directory, run "palm-package.bat framework" (minus quotes)

    2. Whatever ipk was generated in step one (named in your appinfo.json file), use here: palm-install.bat com.whatever.something_0.0.1_all.ipk

    3. Then: palm-launch.bat com.whatever.something

    ReplyDelete
  14. thank you ! finally I can run the phonegap example , now is time to code my own app :D

    ReplyDelete
  15. I've outlined the steps needed to avoid using Cygwin here:
    http://weboscomment.blogspot.com/2012/03/packaging-and-installing-web.html

    Might help some people getting the make errors.

    ReplyDelete