Mark Volkmann's webOS Page

References

Software Installation

Emulator

To start the emulator, double-click "Palm Emulator.app" in the Applications folder and select a resolution (320x480 for Pre, 320x400 for Pixi). This will start VirtualBox if it isn't already running. It is ready to use when the wallpaper is displayed. This can take about a minute.

The following keys are useful in the emulator.

end opens and closes launcher
esc same as back gesture
home minimizes/maximizes current card
left/right arrow switches to application in left or right card

There are many features no currently supported in the emulator including: Accelerometer, Audio, Bluetooth, Camera, Gesture area, Multi-touch, Rotation, Sound, Video and Wi-Fi.

It's Linux!

To SSH to the emulator, enter ssh -p5522 root@localhost. There is no password for the root account, so press return when prompted for one.

The default path is /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:. /usr/local/bin and /usr/local/sbin don't exist. /usr/bin contains awk, curl, sqlite3 and much more. /bin contains common UNIX commands including vi. No scripting languages are installed. Java is not installed.

Enabling Phone For Development

From the Launcher, type "upupdowndownleftrightleftrightbastart" which is the "Konami code". This will cause an icon for the "Developer Mode Enabler". Switch "Developer Mode" from "OFF" to "ON" and press the "Reset The Device" button. No data will be lost.

Packaging Homebrew Applications

To package an application into a .ipk file, follow these steps:

  1. Open a Terminal window.
  2. cd to the directory containing the application directory.
  3. Enter palm-package {app-dir-name}.

Installing Homebrew Applications

To install an application in the emulator or on a device that has been packaged in a .ipk file, not one from the App Catalog, follow these steps:

  1. If installing on the emulator, start the emulator by going to the Finder, selecting "Applications", and double-clicking Palm Emulator.app.
  2. If installing on a device, attach the device to the computer with a USB cable.
  3. When prompted for "Media Sync", "USB Drive" or "Just Charge", choose "Just Charge".
  4. If you accidentally select "USB Drive", eject the device from the computer and continue.
  5. Open a Terminal window.
  6. cd to the directory containing the .ipk file.
  7. Enter "palm-install {name}.ipk

Launching Homebrew Applications

To launch an application in the emulator, follow these steps:

  1. Open a Terminal window.
  2. cd to the directory containing the application directory.
  3. Enter palm-package {app-dir-name}.

Logging

To write to the log from JavaScript code, use functions in the Mojo.Log package. There are three logging functions, info, warn and error. These take any number of arguments. Their toString() values are concatentated to form the log message.

Another useful logging function is logProperties which outputs all the properties of a given object. It takes the object, a String name for the object and a boolean that indicates whether inherited properties should also be output.

For exceptions there is the logException function. It takes an exception object and a String message to be prepended to the log output.

The current logging level is set in the file framework-config.json. The values for the logging levels are 0 for error, 10 for warning and 20 for info. To see output from all logging statements, this file should contain:

{
  "logLevel" : 99
}
      

To see log content, enter "palm-log {app-id} | tail". Get the value of app-id from the id in appinfo.json. Add the -f option to follow additions to the log. This will prevent palm-log from exiting. Press ctrl-c when finished viewing log output.

To see more verbose log messages, ssh to the emulator or device and enter "log {app-id}" while in the /var/home/root directory which is the default directory after running ssh.

CSS Stylesheets

Stylesheets included with the SDK are installed in /opt/PalmSDK/current/share/refcode/framework/200.47/stylesheets. There you'll find global.css (imports many of the others), global-base.css and many more for specific kinds of widgets.

Widget References

To get a reference to a widget after the setup method for it has completed: var widget = $('id').mojo;. To get the value of a widget after the setup method for it has completed: var value = $('id').mojo.getValue();.

Internationalization

See Localization at the developer.palm.com site. The L$ function is used to obtain localized strings.

Scenes

When a scence wishes to push another scene onto the stack it calls pushScene method of the SceneController. This method takes the name of the scene to be pushed and optionally takes additional arguments to be passed to the scene assistant constructor function. The constructor function can save these values in instance fields so they can be accessed by instance methods.

Copyright © 2010 Object Computing, Inc. All rights reserved.