Creating PhotoWear for Samsung

July 18, 2019 · 4 minute read

Porting PhotoWear to Samsung Watches

Our first hint that people wanted PhotoWear on their Samsung watches was the VERY LOUD complaints from some of you Samsung watch owners who found our mobile companion app on the Google Play Store. My ears are still ringing from your frustration! So, with all that demand, why did it take us a year to release PhotoWear for Samsung?

Why a Year?

Because modern Samsung watches don’t run Android Wear OS!

They run Tizen. Surprised? So were we, because we have Samsung phones that run Android and Samsung advertising claims Samsung watches are Android-compatible. But that just means you can pair a Samsung watch to your Android phone. You can’t run Android apps on a Samsung watch.

How hard can that be? Let’s look at a few simple examples.

Difference in Programming Language

Android watch faces are written in Java, a great language balancing ease and power. The internet is filled with examples of just about anything you’d like to do in Android.

But Samsung’s Tizen doesn’t even support Java, let alone the Android libraries. So, we chose C/C++ for PhotoWear Samsung because it is Tizen’s most powerful option, is the core of all the other options, and lets us do things impossible for most other watch faces in the Galaxy Store. C/C++ is a great language too, but Tizen uses a pretty old version of it. And there are few examples showing how to use Tizen libraries, so you have to figure out a lot the hard way.

Java and C/C++ are pretty similar, but you can’t just copy-paste from one to the other. For example consider something easy: writing a log message.

For Wear OS/Java:

Log.d(TAG, "Responding to phone with: " + responseMsg);

For Tizen/C++:

    dlog_print(DLOG_DEBUG, TAG, "Responding to phone with: %s", responseMsg.c_str());

They do exactly the same thing, but they’re pretty different. And that’s the closest we get to copy-pasting between the Android and Tizen versions of PhotoWear!

Difference in Toolset

Android gives us an awesome tool called Android Studio, based on a very popular tool for building all sorts of Java applications. Samsung gives us a similar tool called Tizen Studio that’s pretty good, but much less powerful.

One of my favorite Android Studio features can show me all the places that use a particular function. The best Tizen Studio can do is search for that function’s name, but that often includes a lot of places using completely unrelated functions that just happen to share the same name.

Another example is refactoring. As your program grows, you often find that a variable’s name doesn’t make sense in the context of newer variables you need to add. Improving the name makes it easier to grok the code so you can develop faster with fewer mistakes. Android Studio can reliably change that variable name everywhere in your code. Tizen Studio’s similar feature is much less sophisticated so you always have to very carefully check and manually fix places it made the wrong decision. Sometimes you miss those mistakes and later have to spend hours debugging why something mysteriously broke.

Implementation Challenages

Android automagically does a lot of hard stuff for us. For example, in ambient mode, Android simply dims the entire watch face. Android does all the hard work so we can use the same line of code to draw your photo regardless of whether your watch is currently in active (bright) or ambient (dimmed) mode.

For Tizen, we have to manually darken your photo. If we darken too little, Tizen silently replaces us with their default ambient watch face without ever telling us. But if we darken too much, you can’t see anything. If the watch face app spends too much time figuring out how much to darken, Tizen kills it!

So Android ambient mode just happily displays your photo automatically. But Tizen required a lot of effort figuring out why it hates us and about 500 lines of custom code to make it finally work.

Thanks to YOU!

Getting here took a long time, and we couldn’t have done it without all of your comments, reviews, and especially the feedback from our awesome beta test volunteers. But now that we’ve finally figured out most of the magic spells to support Samsung watches, the only limit is our own imaginations!

Jeremy Chapman
Squeaky Dog Studios Developer