Click here to Skip to main content
15,846,091 members
Articles / Mobile Apps

Create and Run Your First Smart Watch App in 5 Minutes or Less

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
19 Sep 2015CPOL3 min read 12.6K   2   1
Build and run a real smart watch app without even downloading an SDK


This tip describes a simple technique for building and running a smart watch app in 5 minutes or less. Lacking a smart watch, you can even simulate it in jsfiddle!



  1. A tizen os based Gear Smart Watch, such as the Samsung Gear 2 or Gear S
  2. A very low cost 3rd Party app called APE Pad, available from the Samsung Gear App Store
  3. A PC to connect the smart watch to using USB
  4. Notepad or similar text editor

Even if you do not have a smart watch, you can follow along and run the "smart watch app" on your PC any way.

Step 1 - The First 5 Minutes

Connect your Gear watch to your PC using the USB cable. The Gear watch should show up in File Explorer under this PC. Browse to the watch's Documents Folder.

Step 2

Fire up Notepad. Enter or copy and paste the following text:

alert("Hello World")

Save the file with the name HelloWorld.txt to a convenient location such as your desktop. Notepad will not allow you to save directly to the Documents folder of your watch.

Step 3

Using File Explorer, copy and paste the HelloWorld.txt file to the Documents folder of your watch.

Step 4

  1. Run the APE Pad app on your watch.
  2. Click the Menu Button
  3. Choose File... Open
  4. Choose the file HelloWorld.txt
  5. Click the Menu Button
  6. Choose Run (at the very bottom of the menu)
  7. Your watch will display the JavaScript alert "Hello World"
  8. You should have successfully built and run a smart watch app in five minutes or less!

Image 1

Step 5, The Next 5 Minutes and Beyond

Although you can conveniently edit and run the JavaScript directly on the watch in APE Pad, you can also edit and test the JavaScript on your PC using JS Fiddle.

  1. Browse to
  2. Copy and paste the following code to the HTML pane:
           <!DOCTYPE html>
    <p>Click the button to run JavaScript.</p>
    <button onclick="myFunction()">Try it</button>
    <p id="demo"></p>
    function myFunction() {
    //from here
    alert("Hello World")
    //to here
  3. Click the jsfiddle Run button to view the Result
  4. In the Result pane, click the Try it button
  5. Click Ok on the resulting JavaScript alert

Image 2

Time to Get Creative

You can enter almost any valid JavaScript code between the lines //from here and //to here, then test it using the jsfiddle Run button, followed by clicking the Result Try It button. Define code, variables and functions between those 2 lines as needed.

Test until satisfied, then copy and paste the lines between //from here and //to here into Notepad, then save as a txt file. Then copy to the documents folder of the watch, open and run (and edit if desired) in APE Pad.

The following code will use the 4 variables LFt, LIn, WFt and WIn to calculate and display square feet, square yards and square inches. In jsfiddle, or in APE Pad, modify the variable values as desired, then run again!

var LFt = 9
var LIn = 0
var WFt = 12
var WIn = 0

var SF = (LFt + LIn/12) * (WFt + WIn/12)

r = LFt + "' " + LIn + '" x '
 + WFt + "' " + WIn + '"'
 + '\n\n= ' + SF.toFixed(2) + " sq. ft"
 + '\n= '+ (SF/9).toFixed(2) + " sq. yds"
 + '\n= '+ (SF*144).toFixed(2) + " sq. in"

The following code simulates a somewhat sarcastic "magic 8 ball" in either jsfiddle, or in APE Pad.

var answers = [
"As If",
" Ask Me If I Care",
" Dumb Question Ask Another",
" Forget About It",
" Get A Clue",
" In Your Dreams",
" Not",
" Not A Chance",
" Obviously",
" Oh Please",
" Sure",
" That's Ridiculous",
" Well Maybe",
" What Do You Think?",
" Whatever",
" Who Cares?",
" Yeah And I'm The Pope",
" Yeah Right",
" You Wish",
" You've Got To Be Kidding..."
alert("Concentrate on ypur question,\nThen Click OK")
var i = Math.random() * answers.length
i = parseInt(i,10)

Points of Interest

Note that there are some, but actually few restrictions on the JavaScript the watches will run.

Notably, they will run the JavaScript alert() function, but not the JavaScript prompt() function.

You can even use the JavaScript Math functions as desired, such as Math.random() as shown above.

If you feel text only apps are too limited, think back to the APPLE ][ and what was possible with it using just simple applesoft basic!


This is the first version.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
President OutOfNoWare
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

Generalcorrection about prompt() function Pin
lschauer27-Sep-15 4:39
lschauer27-Sep-15 4:39 
although neither the Gear 2 or Gear directly support the javascript prompt() function, ape pad does provide its own prompt function. Not quite identical to the javascript prompt function, it has a 3rd parameter for a callback function. The code below shows how to use it.

a = prompt("enter a number","10",cb)
function cb(a){
alert("your number times 10 " + a*10)

however this implementation of the prompt function makes it not compatible with JSFiddle.
The next version of APE Pad will have 2 new features
1 a prompt function that is compatible with JSFiddle (mostly just a change to the name of the prompt function)

2 the ability to grab the desired javascript portion directly from the JSFiddle web page to the APE Pad app on the Gear S using the tizen "download" api. No need to copy and paste or drag out the usb cable at all!

This will allow you to create, edit and test code in JSFiddle, then directly download and run it on your watch.

What could be a simpler smartwatch SDK?

Watch this tip/trick for future comments...and my next tip/trick on just how easy it really is to "grab files" from the web on the Gear S smartwatch.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.