Android Wear Hero

Gaelan Bolger
Jul 30, 2017 · 3 min read

When setting up an Android Wear device using the official Android Wear application you are shown a photo, known as a hero image, of the specific device you’re setting up.

If you’re setting up a Moto 360 you see this image:

Hero Image — Moto 360 (1st gen)

If you’re setting up an LG Watch Style you’ll be shown this image:

Hero Image — LG Watch Style

While developing my own Android Wear applications I wanted to incorporate these hero images into my companion applications so that users knew exactly what device they were configuring. So I figured I’d give decompiling the official Android Wear application a try to see if I could locate either the hero images in the applications resources or static URLs somewhere in code. After analyzing pretty much the entire APK I had found no real leads and I was feeling pretty bummed.

A couple of days later I thought, “maybe the images are on the wearable’s themselves”. So I pulled the system partition from my LG Watch Style and started poking around. I took an immediate interest in a system application called ClockworkOemSetup and I got to work decompiling it. I found the hero image right away in the APK’s drawable resources. Now I needed to figure out how they were provided to the official Android Wear application.

After some more digging around in the decompiled ClockworkOemSetup’s manifest file I found what I was looking for. As shown below, there is a BroadcastReceiver with an IntentFilter registered for the action “com.google.android.wearable.action.GET_SETUP_DEFAULTS”.

ClockworkOemSetup — AndroidManifest

By checking out the associated BroadcastReceiver I could see that it set a few extras, shown below, pertaining to “product_image_package” and “product_image_resid”. Bingo.

ClockworkOemSetup — SetupBroadcastReceiver

So I quickly made a wearable application that registered a receiver for the “GET_SETUP_DEFAULTS” action at the lowest priority, so I would receive the broadcast after ClockworkOemSetup, and then I sent out an ordered broadcast with the same action. Sure enough when my receiver’s onReceive method was called and I checked the Intent’s extras I had valid values for both the package name and the resource id corresponding to the device’s hero image. All that was left to do was get the bitmap from the provided package’s resources, convert it to an Asset, and, using the Wearable.DataAPI, call putDataItem so that my companion application could then retrieve the DataItem and cache the hero image to disk.

This method of retrieving a wearable’s hero image should work across all versions of Android Wear. I tested it on an LG Watch Style running AW 2.0 and a Moto 360 running AW 1.5. The package name and resource id returned from the ordered broadcast will differ depending on device and emulators have no hero image so the Intent extras will not exist (though I was able to make my own hero image provider and install it to an emulator).

Thanks for reading, I hope you’ll find this info useful while you develop your Android Wear applications!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade