A downloadable native app is a 3rd party native app that can be installed on the webOS target device.
Downloadable vs. Built-In
In webOS OSE, apps and services can be classified into two types based on how they are installed on the target device.
Downloadable apps/services are installed by the appinstalld service. The appinstalld service creates webOS configurations based on files created by developers. (such as trust level) Developers can modify only certain parts of the app/service settings.
Built-in apps/services are built and installed by developers. Developers can customize app/service’s configurations to suit their needs.
This tutorial shows a step-by-step guide for creating a downloadable native app from scratch.
After installing the CLI, you must register your target device. Enter the ares-setup-device command to start an interactive mode:
Note In the interactive mode, pressing the Enter key means to use the default value.
document@document:~$ ares-setup-device
name deviceinfo connection profile
------------------ ------------------------ ---------- -------
emulator (default) developer@127.0.0.1:6622 ssh ose
** You can modify the device info in the above list, or add new device.
? Select add # Select 'add'.? Enter Device Name: webos # The nickname of your target device. Use the short name.? Enter Device IP address: 127.0.0.1 # The IP address of your target device? Enter Device Port: 22# Just press the Enter key. Do not change this value.? Enter ssh user: root # Just press the Enter key. Do not change this value.? Enter description: new device # Descriptions about your target device? Select authentication password # Select 'password'? Enter password: [hidden]# Leave it blank (Press the Enter key).? Set default ? No # Enter 'y' if you want to set this device as the default device.? Save ? Yes # Enter 'Yes'.name deviceinfo connection profile
------------------ ------------------------ ---------- -------
webos root@127.0.0.1:22 ssh ose
emulator (default) developer@127.0.0.1:6622 ssh ose
Native Development Kit
Native Development Kit (NDK) is a set of tools that include toolchains, libraries, and header files. NDK enables you to build a native app on your computer.
Go to your app directory. (samples/native-apps/downloadable/com.sample.waylandegl/)
Create a build directory and go into the directory.
$ mkdir BUILD
$ cd BUILD
Execute the build commands.
$ cmake ..
$ make
If the commands succeed, a pkg_<YOUR_ARCHITECTURE> directory will be generated in your app directory. <YOUR_ARCHITECTURE> depends on your build machine’s architecture.
In the following example, the pkg_aarch64 directory is generated.
CMake is a tool for supporting cross-platform build. Developers configure prerequisites and build steps in CMakeLists.txt, and then CMake reads this file, creates the build system, and builds the project.
cmake_minimum_required(VERSION2.8.7)project(wayland_eglCCXX)include_directories(${CMAKE_SOURCE_DIR})include_directories(${CMAKE_SOURCE_DIR}/src)include_directories(${CMAKE_SOURCE_DIR}/include)include(FindPkgConfig)pkg_check_modules(WLCLIENTREQUIREDwayland-webos-client)include_directories(${WLCLIENT_INCLUDE_DIRS})pkg_check_modules(WLEGLREQUIREDwayland-egl)include_directories(${WLEGL_INCLUDE_DIRS})pkg_check_modules(GLESV2REQUIREDglesv2)include_directories(${GLESV2_INCLUDE_DIRS})set(BIN_NAMEwayland_egl)set(SRC_LIST${CMAKE_SOURCE_DIR}/src/wayland_egl.c)set(CMAKE_RUNTIME_OUTPUT_DIRECTORY"${CMAKE_SOURCE_DIR}/pkg_$ENV{OECORE_TARGET_ARCH}/")add_executable(${BIN_NAME}${SRC_LIST})set_target_properties(${BIN_NAME}PROPERTIESLINKER_LANGUAGEC)target_link_libraries (${BIN_NAME}${WLCLIENT_LDFLAGS}${WLEGL_LDFLAGS}-lEGL${GLESV2_LDFLAGS})# copy appinfo.json file to output folder
if(EXISTS"${CMAKE_SOURCE_DIR}/appinfo.json")file(COPY"${CMAKE_SOURCE_DIR}/appinfo.json"DESTINATION${CMAKE_RUNTIME_OUTPUT_DIRECTORY})else()MESSAGE( "'appinfo.json' file was not found !!")endif()# copy icon.png file to output folder
if(EXISTS"${CMAKE_SOURCE_DIR}/icon.png")file(COPY"${CMAKE_SOURCE_DIR}/icon.png"DESTINATION${CMAKE_RUNTIME_OUTPUT_DIRECTORY})else()MESSAGE( "'icon.png' file was not found !!")endif()