How I put my own app on a 2018 Samsung TV (and the error that nearly stopped me)
My living room TV is a 2018 Samsung running Tizen. I wanted my own app on it: a calm home screen with the time, the weather and prayer times, and later one app for my audiobooks, ebooks and films. Samsung doesn’t make this easy for a normal retail TV. It took me a long evening, mostly because of one step that almost no guide mentions. This is the recipe that worked, in order. I tried skipping steps and each one I skipped broke something.
What a Tizen TV app is
A Samsung TV app is a web app: HTML, CSS and JavaScript zipped into a .wgt file with a config.xml. Mine is a thin full-screen page that loads a small web server running on my home server, so I can change the app without reinstalling it.
Two things to know about a 2018 TV. Its browser engine is roughly Chrome 56, so no CSS gap, no inset, no optional chaining in JavaScript. And it only accepts apps signed with a Samsung certificate, not the generic Tizen one.
Step 1: turn on developer mode
- Open the Apps panel on the TV.
- Type
1 2 3 4 5with the remote’s number keys. If your remote has no numbers, the SmartThings phone app’s remote does. - Switch Developer Mode on and enter the IP address of the computer you’ll install from.
- Restart the TV. Hold the power button until it goes off and on, a quick press only puts it to standby.
Then connect from your computer with sdb, Samsung’s version of adb:
sdb connect 192.168.1.20:26101
Use your TV’s address. sdb devices should list it.
Step 2: install the Tizen command-line tools
Samsung’s installer for Linux is web-cli_Tizen_Studio_<version>_ubuntu-64.bin. It puts a tizen command under ~/tizen-studio/tools/ide/bin. Then add the certificate tools with the package manager. The package names are comma separated with no spaces:
~/tizen-studio/package-manager/package-manager-cli.bin install Certificate-Manager,cert-add-on
Step 3: make a Samsung certificate
Open the Certificate Manager and create a Samsung profile (not Tizen). It asks you to:
- create an author certificate,
- sign in with a Samsung account in your browser,
- pick the Public privilege level and the TV device type,
- add your TV’s DUID. With the TV connected over
sdb, the manager can read it for you.
On my Linux machine the Certificate Manager window wouldn’t start at all. The fix was to copy the full Certificate Manager product from its zip into the Tizen Studio tools folder, drop the cert-add-on plugin into its dropins folder, and delete a couple of old Java options (-XX:+AggressiveOpts) from its eclipse.ini that newer Java versions refuse.
Step 4: build and sign the app
In config.xml, set the profile to tv-samsung and only ask for Public-level privileges, such as internet. Then, from the app folder:
tizen package -t wgt -s samsungtv -- .
samsungtv is the name of your certificate profile.
Step 5: the missing step, install-permit
This is where I lost an hour. Installing kept failing with error 118012. Forum posts blame expired certificates, a wrong DUID or the TV’s clock. None of that was it.
The TV needs to be told to trust your certificate first:
tizen install-permit -s 192.168.1.20:26101
Run it once per TV. After that, installs work.
Step 6: install with a file name that has no spaces
The package gets its file name from your app’s display name. Mine was Cloud Home.wgt, and installing it said only “Failed to install”, nothing else. Copy it to a name without spaces and it goes through:
cp "Cloud Home.wgt" CloudHome.wgt
tizen install -n CloudHome.wgt -s 192.168.1.20:26101
The app now shows up in Apps on the TV like any other.
Living with it
To launch the app from a script, don’t bother with sdb. Its launch commands are blocked on retail TVs. The TV’s own WebSocket remote API works, and I use the samsungtvws Python library’s run_app with the app’s ID.
The coloured buttons and the media keys only reach your app if you ask for the tv.inputdevice privilege and call tizen.tvinputdevice.registerKey() for each key. Without that they silently do nothing.
The app stops working when the certificate expires, about a year later, so put a reminder in your calendar to reinstall with a fresh one.
A firmware update can switch Developer Mode off. I block Samsung’s firmware update server at my Pi-hole so my apps stay put. That does mean I update the TV by hand, when I choose to.
What I built with it
I now have three of my own apps on the TV: an ambient home screen, a launcher, and a media app for my audiobooks, ebooks, offline Wikipedia and films, all served from my own server. My own apps now sit on the TV next to Netflix and YouTube.
I build small free tools and games at cloudmaking.co.uk, if you want to see more of what I make.