Skip to main content

WebView Code Sample

polyos-webviewlauncher

polyos-webviewlauncher is a prototype launcher activity with a WebView with injected JavaScript PolyOS APIs that may be consumed by a web application.

WebLauncher Repository

Please contact todd.page@poly.com for access to the WebLauncher Application.

Application Overview

This application is also part of the PolyOS Firmware and can be selected in the Provider List. The unit must be dev enabled or you will not see the WebLauncher App.

It is designed so a developer who is focused on building WebApps can quickly get started. The Settings menu has a number of helpful tools and sites to speed up development.

You can set one URL for the codec and another for the TC8, or you can keep them in sync. We have a sample TC8 app available now that provides some camera controls. The TC8 webapp is hosted here:
https://betabuilds.aus-ms.pad.zone/index.html

If you use this this link for the TC8 URL, you will see a very basic page that provides full camera control options (autoframing toggle, full PTZ controls, camera presets, camera ID, volume control,etc.).

1. Install the APK

Using the adb command line tool, connect it to the Poly device and install the APK:

adb connect <poly-ip-addr>
adb install -r polyos-webviewlauncher.apk

Alternatively, the Android Studio IDE may be used to build, install, and run the application on the Poly system.

2. Authorize the Application Package

The sample application must be granted access to the Poly OS API services by adding it to the list of whitelisted packages in a Poly system configuration variable:

Open a root shell to the Poly system. This only needs to be done once and the configuration will persist between reboots.

adb connect <poly-ip-addr>
adb root
adb shell
# cd opt/polycom/bin

/opt/polycom/bin/pbcfg -r kSystem --write system.ecomode.app[20].persona --value 'weblauncher'

/opt/polycom/bin/pbcfg -r kSystem --write system.ecomode.app[20].primarypackage --value 'com.poly.polyos.weblauncher'

/opt/polycom/bin/pbcfg --role kSystem --write system.ecomode.app[20].enabled --value True

/opt/polycom/bin/pbcfgwrite system.ecomode.home.launcher 0 'com.poly.polyos.weblauncher'

3. Create an HTML Host

Host a web application that will consume the Poly OS APIs on a web server that is HTTP accessible to the Poly system. The URL to this host will be passed to the WebView activity launched by this application below, in the following step.

A sample HTML/JavaScript that demonstrates example usage of many of the Poly OS JavaScript APIs is in the example-html-app directory of the WebView Launcher repository.