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:
- Accelerometer live data (does support orientation and shaking events)
- Audio
- Bluetooth (UI and any interface-specific APIs do not work in the Emulator)
- Camera
- Gesture area
- Multi-touch
- Sound
- Video
- Wi-Fi (UI and any interface-specific APIs do not work in the Emulator but, with a desktop connection, network connectivity does.)
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:
-
Changes made during development and debugging may not appear unless you first delete the previous version, and then repackage and reinstall the updated application.
-
Installing a new version of an application does not remove source files not present in the new version. During testing, we recommend you delete the old version of an application before installing a new version.
-
If you do not have the Emulator running, but do have a webOS device plugged into your computer's USB port, the command-line tools will use that if the device has developer mode enabled. You will find your app's icon at the bottom of the first launcher menu. When plugging the device into the computer to load an app, select the "Just Charge" option on the device.
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:
-
Select
Run > Run Configurations... -
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:
-
Use the Debugger.
-
Use the Emulator's console output:
-
Open a device shell (scroll to the Emulator section).
-
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:
-
In the Applications folder, double-click the VirtualBox icon.
-
On the VirtualBox menu, select Preferences.
-
Switch to the Input section.
-
Press the right command key to switch the Host Key, and then turn off Auto Capture Keyboard.
-
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
- Start the Emulator and choose an image
palm-emulator
- List the available Emulator images
palm-emulator --list
- Start the Emulator image named "SDK-1.4 (320x480)"
palm-emulator --start "SDK-1.4 (320x480)"
- Stop the Emulator image named "SDK-1.4 (320x480)"
palm-emulator --stop "SDK-1.4 (320x480)"
- Install a new Emulator image
palm-emulator --install "~/Downloads/SDK 1.4.5.452.vmdk.zip"
- Remove a user-installed Emulator image
palm-emulator --remove "SDK 1.4.5.452"
- Remove all user-installed Emulator images
palm-emulator --remove-all