Get Started on LG webOS

LG webOS is just one of the many target platforms for You.i React Native apps. Use the instructions below to run our quick start app on an LG TV device.

Before You Start

To build a You.i React Native app for LG webOS, you’ll need to have a Linux development platform, such as Ubuntu. Consult the Environment Setup topic to verify that everything is set up properly.

Install Prerequisites

Install the GNU Debugger for Multi-Architecture

To install the GNU Debugger for multi-architecture:

sudo apt-get install build-essential gdb-multiarch
sudo apt-get update

Install the LG webOS NDK

Download and unzip the webOS NDK. Once done, follow the instructions in the Install.txt file, which is part of the NDK zip file, to install the NDK.

Install the Linaro ARM Toolchain

You.i Platform uses a third-party toolchain.

Download and unzip the following Linaro ARM Toolchain for webOS 4.

Configure Environment Variables

Set the following environment variables in your configuration file, such as .bash_profile or .zshenv:

# add to your configuration file (~/.bash_profile, ~/.zshenv, etc) and reload
export WEBOS4_GCC_HOME=<path to webOS 4 Linaro ARM Toolchain>
export WEBOS4_NDK_HOME=<path to the webOS 4 NDK>

Your First App

Once your dev environment is all set up, we recommend running through our Quick Start Guide. But if our Quick Start isn’t quick enough for you, here’s an even quicker start.

Install the You.i TV command line interface tool, You.i Platform, and any required dependencies youi-tv doctor requests.

yarn global add youi-cli
youi-tv login    # Enter your product key when prompted.
youi-tv install 6.15.0  # If asked, accept most recent version of Babel or other dependencies
youi-tv doctor   # Resolve any missing components (but don't worry about Android for now)

Set up scaffolding for your app with youi-tv init.

youi-tv init MyApp  # Create a folder called MyApp for your project
cd MyApp

Validate Your Config

Use youi-tv doctor to validate your configuration. Make any changes needed to meet the requirements.

Run Your App

If it’s not already running, start the Metro bundler (Yarn server) from your development platform.

yarn start  # can be run from any folder in your project

Generate, build, deploy, and launch the project.

cd MyApp
youi-tv run -p webos4

For more information on deployment, see Deploy.

If You Had Issues

If you had any issues with this tutorial, you can download a zip file with the completed JavaScript and C++ files. The files contain updates for the entire tutorial and won’t run for all the steps, but they’re useful guides for adding lines of code.

Debugging

LG webOS 4 devices provide an instance of a GDB server. You can connect to the devices via gdb-multiarch. For example:

Ensure that you have installed gdb-multiarch on your computer using the following command:

sudo apt-get install gdb-multiarch

Run the gdb server on the device using the following command:

/opt/webostvndk/cli/bin/ares-gdbserver <package-name> -d <tv-device-name>

Run gdb-multiarch.

gdb-multiarch <path-to-executable>

Connect to the LG webOS device.

target remote <IP-address>

Add break points and start the application.

break

   <code>

continue

Logging

Though not all TV versions and models provide app logging, you can run the following command to get logging while an app is running on the LG webOS device:

<LG-webOS-NDK-folder>/cli/bin/ares-log -d <tv-device-name> -s 0s -f

Deployment

To deploy to a LG webOS TV, follow the instructions on LG’s developer site:

  1. Access the developer mode.
  2. Install the developer mode app.
  3. Connect your machine with the LG webOS TV using the CLI.
  4. Install the app.