Emulator

The HP webOS Emulator simulates a webOS device on a Linux, Mac, or Windows computer. It is built on VirtualBox, free virtual machine software from Oracle/Sun. If you installed the SDK, you already have the Emulator on your computer.

The Emulator includes a Radio Simulator that lets you simulate phone calls and GPS fixes.

Currently, the Emulator does not support the following:

To start the Emulator:

Open a command prompt or SSH (Mac), type "palm-emulator" and press "Enter". You are then asked to choose an image.

Note

The Emulator has a number of command-line options, including one to do a hard reset. See the Command-Line Reference for more information.


Using Command-Line Tools to Run Apps

You can use the webOS SDK command-line tools to package, install, launch, close and uninstall your app on the Emulator. The process for doing this is the same as it would be for a device.

Example usage:

Start the Emulator (and choose an image), package, install, launch, close and uninstall an app (executed from a command prompt in the workspace directory).

> palm-emulator
> palm-package HelloWorld
> palm-install com.mystuff.hello_1.0.0_all.ipk
> palm-launch com.mystuff.hello
> palm-launch -c com.mystuff.hello
> palm-install -r com.mystuff.hello

See the tools documentation for more information.

Notes:


Using Eclipse to Run Apps

If you are using Eclipse with the HP webOS plug-in, do the following to run an application on the Emulator:

  1. Select Run > Run Configurations...

  2. Select "Palm Emulator" for the target of your application name.

On subsequent activations, select Run > Run As... > Mojo Application.

Eclipse automatically packages, installs, and launches the application. With Eclipse, there is no need to uninstall the application before re-running it.


Running PDK Apps

Starting with webOS 3.0, you can run x86-compiled PDK code in the Emulator in either full-screen or hybrid mode. SDL APIs are supported, but OpenGL ES is not.

To build PDK code, you need a separate x86 toolchain. On Windows, you can download the current CodeSourcery G++ Lite cross-compiler.


Debugging Your Application

You have two ways to debug an application in the Emulator:

  1. Use the Debugger.

  2. Use the Emulator's console output:

    1. Open a device shell (scroll to the Emulator section).

    2. At the command prompt, type "log com.yourdomain.your-app" and press "Enter".

For more info about generating logs from your application, see Logging (Mojo apps) and palm-log (all apps).


Keyboard Shortcuts and Accelerometer Events

Key Description
Alt (Windows and Linux)
Option (Mac)
Option key
End Opens and closes the launcher
Esc Performs the back gesture (or swipe back)
Home Minimizes and maximizes the card
Left/Right Arrow Switches the application left or right in the Card view
Control Sym (symbol) key
Accelerometer Events
F5 Simulates shaking
F6 Simulates "up" (12:00 or normal) orientation
F7 Simulates "right" (3:00) orientation
F8 Simulates "down" (6:00) orientation
F9 Simulates "left" (9:00) orientation

For accelerometer events, note that the orientation keys will only be active if Window Orientation has been set to "free".


Keyboard Capture on the Mac

By default, VirtualBox captures the keyboard into a virtual machine. On the Mac, this can interfere with using the left command key to switch among applications with command-tab. If you run into this problem, try the following:

  1. Exit the Emulator.

  2. In the Applications folder, double-click the VirtualBox icon.

  3. On the VirtualBox menu, select Preferences.

  4. Switch to the Input section.

  5. Press the right command key to switch the Host Key, and then turn off Auto Capture Keyboard.

  6. Press OK, and then close VirtualBox.


Using Emulator Host Mode

The webOS SDK Emulator (version 1.4.1 and later) includes a feature called Emulator Host Mode. This mode allows you to inspect your application using a desktop browser (Chrome or Safari). To accomplish this, the Emulator now contains its own Web server that renders your application on port 8080, which is automatically mapped by the "palm-emulator" tool to port 5580 on your desktop.

After the Emulator is started, you can launch a browser on your desktop and render any applications in your browser directly! (Note that if using Chrome, you will need to disable the popup blocker.)

To use Emulator Host Mode

In a Web browser (Chrome or Safari), enter the following URL:

http://localhost:5580/


Exiting the Emulator

Select Machine > Close > Power off the machine > OK

Note:

If you choose a different option, you cannot install applications on the Emulator the next time you start it.


Command-Line Reference

Command-line usage for the HP webOS Emulator.

Syntax

palm-emulator [OPTION...]

Options

      Option                     Description
    --list                   List the available Emulator images
    --start=IMAGE            Start an Emulator image
    --stop=IMAGE             Stop an Emulator image
    --reset=IMAGE            Reset an Emulator image
    --install=IMAGE_FILE     Install an Emulator image
    --remove=IMAGE           Remove a user-installed Emulator image
    --remove-all             Remove all user-installed Emulator images
    --version                Display version info and exit
    --help                   Display this help and exit

Usage Notes

IMAGE is the name of an Emulator image, including the resolution.

IMAGE_FILE is the file path of the Emulator image file to install.

Note that SDK-installed Emulator images cannot be removed.

If no options are specified, an image selection window will be displayed.

Examples

 palm-emulator

 palm-emulator --list

 palm-emulator --start "SDK-1.4 (320x480)"

 palm-emulator --stop "SDK-1.4 (320x480)"

 palm-emulator --install "~/Downloads/SDK 1.4.5.452.vmdk.zip"

 palm-emulator --remove "SDK 1.4.5.452"

 palm-emulator --remove-all