Skip to main content

Hacking Android Wear: Part One





A few weeks ago, I finally got my hands on the Samsung Gear Live. It's a smartwatch powered by Google's new Android Wear operating system. And like pretty much everything I buy with a screen, I started messing around with it.

It turns out that Android Wear isn't as far off from normal Android as I thought - with some caveats, it's possible to install plain Android apps manually. So I published a video of Minecraft Pocket Edition on my watch, which became somewhat popular. I've made a few more videos since then, my most popular one (currently) being a demo of Windows 95.

Many people have asked me for a tutorial, so I'm splitting this into a few sections for better organization. This part introduces you to ADB and manually installing applications. This will not void your warranty on your watch, and this works with any Android Wear watch. This may seem long, but that's just because I've explained everything in great detail for beginner users.

Installing ADB

ADB, which stands for Android Debugging Bridge, is a program designed to help developers test their applications on Android devices. It's also useful for recovering corrupted devices, and other power-user tasks.

If you have Windows, this tool works great for installing the ADB program (just follow the directions there). If you have a Mac or Linux computer, I've written my own ADB installer called Nexus Tools (directions on the page). Once you have ADB installed (you can test by typing 'ADB' in the command line/terminal and see if it prints out help), you can continue to the next part.

Enabling Debugging Mode

Now go to the Settings app on whatever Android device your watch is paired to, go to About Phone, and keep tapping the 'Build number' until a message says 'You are a developer!'. Go back to the main screen and press the new 'Developer' menu item. Now tap 'USB Debugging' to enable your computer to access your phone via ADB.

Now we have to do the same thing, but on the watch. On the home screen of your watch, say 'okay google, open settings' or hold down the power button on your watch. Now that you are in Settings, scroll to 'About' and press the 'Build number' until you get the same 'You are now a developer!' message.

Go to the Developer Options in the watch settings and tap 'ADB Debugging' and 'Debugging over Bluetooth'. Finally, open the Android Wear app on your phone, press the Settings button on the top right, and check 'Debugging over Bluetooth'. It should say 'Host: disconnected' and 'Target: connected' after you're done.

Tip: You might also want to turn on 'Stay awake while charging', because when the screen turns off whatever app you have open will quit. This will keep the screen on as long as you have your watch plugged in (remember to turn it off after you're done!

Installing applications

Now for the fun part - installing Android apps on your watch. Android applications are stored in files called Android Application Packages, or .apk files. You can find APK's of popular Android apps on various websites, or copy them straight from your phone.

For this tutorial we will use a port of GL Tron found on the F-Droid store. Click here to download the APK, then find it on your hard drive. If you're on Windows, open the Command Line by opening the Start Menu and typing 'cmd' in the search. On Mac and Linux, open the Terminal app.

Plug your phone into your computer via USB, type 'adb devices' in the command and press enter. It should print something like this:

List of devices attached
03107f69d0218bba device

Congratulations, this means you have successfully connected your phone to your computer! But now we have to get your watch connected too. Type these commands into the command line (press enter after each command):

adb forward tcp:6666 localabstract:/adb-hub
adb connect localhost:6666

Now do the same 'adb devices' command. If you've followed these steps correctly, you should see a new device called 'localhost':

03107f69d0218bba   device
localhost:6666          device

Now let's try installing that game. Type 'adb -e install', a space, and then drag the APK file into the command line window. It should result in something like this:

adb -e install C:\Users\corbin\Downloads\com.glTron_4.apk

Now press enter and watch the magic. If you see 'Success' you, well, succeeded! But how do you get to your apps? Well, you can tap on the home screen (bringing up the OK Google screen), and scroll down until you see Start. Tap it, and you will see all your apps (Android Wear, as well as the ones you installed) on the list. You can also install Wear Mini Launcher on your phone to give easy access to your apps as well, or say 'ok google, run gl tron' with voice.

You should see GL Tron on your apps list, tap it and press the left or right sides of the screen to control your lightcycle. Congratulations, you just installed an Android app on your watch!

What works and what doesn't

The above tutorial also works for almost any application, except these: 
  • Apps that require internet access. Android Wear has no API for direct internet connections, so apps that require an internet connection for any reason either crash or report that you are not connected to the internet. This is no longer true, Android apps that require internet access can be used by disconnecting the host phone and making sure the watch is connected to WiFi.
  • Apps with an action bar. An action bar is the top bar found in some apps, see here for examples on what they look like. In some cases, apps just hide the action bar instead of crashing. 
  • Apps that use video. Almost all video players (and apps that use video) crash on Android Wear, due to the lack of built-in video playback. Only some software-accelerated video players work, like QQPlayer. 
  • Apps that aren't built for small screens: Some apps just really don't like that you have a tiny screen, and either encounter bugs or have buttons cut off. Increasing the DPI with ADB may help, but it's reset on the watch's reboot and makes everything on the screen smaller. 

Uninstalling Applications

Uninstalling applications is a bit more work than installing them, I tried dozens of app removers and none of them seemed to work on Android Wear (it must be missing some libraries for that to work). Instead, you have to remove them on your computer via the ADB tool. Type this into the console:

adb -e shell pm list packages -3

This will list all the applications installed on your watch (not including system apps, which you can't delete anyways). Find the ID of the app you want to un-install, for this example we will uninstall GL Tron. The ID will begin with something like com. or org. and end with the name of the app. So in this case, the ID is:

com.glTron

Now to un-install it, simply type this command and press enter:

adb -e uninstall com.glTron

You will notice that the ID of the app you want to un-install is at the end of the command. Once the command prints 'Success', the app should be deleted from your watch.

Popular posts from this blog

QuickChrome is now NoPlugin

Back in January, I released a new Chrome extension called QuickChrome. With Chrome 45 completely dropping support for plugins, and other browsers trying to do the same thing, I thought it would be a fun project to try and restore some functionality.

QuickChrome detected any QuickTime player objects on websites, and if Chrome supported the video format, replaced it with Chrome's built-in video player. If not, it gave you a link to download the file and play it on your machine. I figured being able to play some content with Chrome's video player, and a download link for others, was much more useful than a useless 'Missing Plugin' error.

Well, for some reason it blew up in popularity. So I gave it a much-needed upgrade - say hello to NoPlugin!

NoPlugin is basically QuickChrome, but better. It now supports detecting Windows Media and RealPlayer plugins. For anything that it can't play inside the browser, it now provides a one-click download and this new notification to…

How to make a flash drive sync with OneDrive

I’ve wanted cloud storage services like OneDrive or Dropbox to make flash drives that sync with their services for a while, and there doesn’t seem to be anything like it on the market. This would be immensely useful on shared/public computers, for when you need to access files without using the often less-useful web app or installing the normal sync app.

My goal was to make a flash drive that fully synced with OneDrive, that could be used on public (specifically school computers). This should work for any Windows XP SP2+ computer, as long as whatever restrictions are in place allow running programs from a flash drive (some organizations only allow pre-installed software to be run, for instance). So here’s how I did it.
Setting it up First, create folders on your flash drive called ‘OneDrive’ and ‘Sync’. The first will serve as the folder where your OneDrive files are kept, and the second where the program that syncs your files will be installed to. It should look something like this: