Build Your First App for webOS TV
Here’s how you build your first app for webOS TV.
TipIn each step, you will be guided to enter your app or device information. If you enter this information, the following command syntax will be customized for you. It is optional, but we recommend you give the information. It will help understand the syntax a lot more than when it is with the default values.
Create an app with CLI
- Download and install webOS TV CLI.
- Create a new app with the ares-generate command. With this example, you will use a template named
basicto generate a new app.
ares-generate -t basic ./sampleApp
- Type in
version.If the app is successfully generated, you will see
? app id com.domain.app ? title new app ? version 0.0.1
Generating basic in ./sampleApp Success
You can try running the app on the simulator, or if you have a real TV device and want to test the app on it, you need to package and install the app first.
Launch the app on the simulator
- Download and install the webOS TV Simulator.
- Launch your app on the simulator with the area-launch command.If the app is successfully launched, you will see Hello, World! on the simulator.
ares-launch -s 23 ./sampleApp
Package, install, and launch the app on a TV device
To test the app on a TV device, you first need to install Developer Mode app and connect your PC with the TV device. For how, see Developer Mode App.
- Package the app in the
sampleAppdirectory with the ares-package command.If packaging is successful, you can see the created package (
.ipk) file in the current working directory.NoteYou can specify a directory where the package file is to be created using the
-ooption. For details, see ares-package.
- Install the package file to the TV device with the ares-install command. Be sure to type correctly the file name of your package.
ares-install -d myTV com.domain.app_0.0.1_all.ipkNoteIf you have specified the directory where the package file is to be created using the
-ooption, make sure that you specify the path, as well as the file name, of your package correctly.
- Launch the app on the TV device with the area-launch command.If the app is successfully launched, you will see Hello, World! on the TV device.
ares-launch -d myTV com.domain.app
See alsoHere's the list of recommended activities you can do next.
- To create a hosted web app, go to Hosted web app. If you are planning on an app that requires continuous update, a hosted web app is a good choice.
- To learn about the lifecycle of an app, go to App Lifecycle. Understanding the app lifecycle will help you have a rough sketch on how your app will work.
- To learn about JS services on webOS, go to JS Service Basics. JS services allow your app to do some work, even when it is not running.