Wednesday, September 16, 2015

GETTING YOUR SMART TV APP TO SAMSUNG TV (OS X).

I’ve been studying Samsung Smart TV development environment for a week now. Yesterday I finally got my first app deployed to my TV, but I gotta say, Samsung didn’t make it too easy and the developer community ain’t the most lively one. That’s why I decided to tell you in my first tutorial, how to do the trick.
Before hopping in to the action, I’d like to remind you, that there are instructions for deploying the app on Samsung developer page. However, it seems those instructions are a bit outdated. I also assume you’ve already fooled around a bit with Samsung Smart TV SDK 5.0. If not, you can find the software from here and come back when you’re familiar with it.
This tutorial is for Samsung SDK 5.0 and Mac OS X (Mountain Lion).

1. INSTALLING THE SERVER

Apache server in Mountain Lion is not as easily accessible as before, but it’s still running in the system. Follow these instructions and you will get it started and configured.

2. ECLIPSE SERVER SETTINGS

In Eclipse, open Preferences > Samsung SmartTV > Server
Screen Shot 2014-01-20 at 10.18.21 PM
If you don’t know what is the IP of your computer, go to System Preferences > Network > Advanced > TCP/IP. Then look for “IPv4 Address”.
As you can see, I’ve set my root folder to /Library/WebServer/Documents/samsung. You can name the folder whatever you like.
When the app package is exported from SDK it is supposed to create .zip file in the server folder. That’s not what happens with me, but it doesn’t matter because the file can be copied in to the right place. However, it’s probably a good idea to set the server IP and folder properly.

3. EXPORT

This differs quite a bit from what Samsung says in the developer guide.
Right click the app you want to export at Project Explorer window and select Export. If Project Explorer is not visible, open it from Window > Show View.
Screen Shot 2014-01-20 at 10.39.35 PM
Open Samsung Smart TV Apps from folder tree and select “Package file”.
Screen Shot 2014-01-20 at 10.41.55 PM
Click “Next”.
Screen Shot 2014-01-20 at 10.43.57 PM
Select region, toggle “Update the packaged files on the server” (for me it doesn’t), set title and description and click “Finish”. Now you’ll get a popup window which tells where the package is located. For me, they go to /Users/jaakkokarhu/Package/, so probably it’s something similar for you too.
4. COPY/PASTE THE .ZIP FILE TO RIGHT SERVER FOLDER
Now find the created package (.zip) file in your Finder. Copy it to the server folder you set before (step 2, remember?). If the folder doesn’t exist, create one.

5. CREATE WIDGETLIST.XML

Okay, this step is very important, so pay attention. You need a file named “widgetlist.xml” to tell Samsung Smart TV, where the zipped app is located in your server. Open notepad or TextWrangler or whatever you prefer and copy this code to it:
<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="ok">
  <list>
    <widget id="AwesomeApp">
      <title>AwesomeApp</title>
      <compression size="10" type="zip"/>
      <description>This app is very, very awesome!</description>
      <download>http://10.0.1.3/samsung/AwesomeApp_0.1_Europe_20140120.zip</download>
    </widget>
  </list>
</rsp>
Now let’s take a look of the file a bit.
Compression size is the package size. I just put there number 10 to demonstrate how little it matters.
<compression size="10" type="zip"/>
Fill description as you like.
<description>This app is very, very awesome!</description>
Be careful with following line, because that tells the TV where to look for the package file. When Smart TV connects to your computer, it at first looks for the widgetlist.xmland then download tag tells where the file actually is. If this is not set properly, the installation won’t begin.
<download>http://10.0.1.3/samsung/AwesomeApp_0.1_Europe_20140120.zip</download>
Replace “samsung” with whatever is the folder you like to keep your apps and “AwesomeApp_0.1_Europe_20140120.zip” with the name of the .zip file.
Save the file with name “widgetlist.xml” to the server root. So, ie. my root folder is/Library/WebServer/Documents.

6. CREATE DEVELOPER ACCOUNT TO SAMSUNG SMART TV

Actually you don’t need to create the account because it’s built in the system. Grab your remote and open Smart TV. Select login and create new account with the name developer. In my model I don’t need to set password but there can be differences.
Oh, and make sure that your TV is connected to same router as your computer.

7. UPLOAD YOUR APP

Fingers crossed now…
When you’re logged in as a developer, select Tools > Developer. Set your IP (yes, the one you’ve found earlier) and select “User Application Synchronization”.
The installation should begin shortly and after it you should see a thumbnail of your app with text “User”.

No comments:

Post a Comment