Search code examples
androidwear-oswatch-face-api

How to run Android Sample Watch Face?


This is what I did

  1. File->Import Sample
  2. 2 modules created. Application and Wearable
  3. Which one to execute? I tried both anyway
  4. I did not encounter any error
  5. I noticed "Session 'Application' Running" / "Session 'Wearable' Running" on bottom left when I run it enter image description here
  6. But still I cannot see it anywhere both on phone and smartwatch

I read this Setup Android Wear Device

  1. Install the Android Wear app, available on Google Play, on your handheld.
  2. Follow the app's instructions to pair your handheld with your wearable. This allows you to test out synced handheld notifications, if you're building them.
  3. Leave the Android Wear app open on your phone.
  4. Connect the wearable to your machine through USB, so you can install apps directly to it as you develop. A message appears on both the wearable and the Android Wear app prompting you to allow debugging. Note: If you can not connect your wearable to your machine via USB, follow the directions on Debugging over Bluetooth.
  5. On the Android Wear app, check Always allow from this computer and tap OK. The Android tool window on Android Studio shows the system log from the wearable. The wearable should also be listed when you run the adb devices command.

On point number 4 above. How to really connect my smartwatch to my laptop through USB?!?!?

I have Nexus 5 and Moto 360 with latest Android Studio.


Solution

  • I would double check that debugging in enabled on the wearable and the Android Wear app. Otherwise if you have a Moto 360 the only way you can debug your app on the watch is through bluetooth.

    It is important to note that when your app is not signed for production you will have to install the app directly onto the wearable itself.

    If you need to connect via bluetooth do the following:

    To enable debugging for wear do the following:

    1. On the handheld, open the Android Wear companion app.

    2. Tap the menu on the top right and select Settings.

    3. Enable Debugging over Bluetooth. You should see a tiny status summary appear under the option:

      Host: disconnected

      Target: connected

    4. Connect the handheld to your machine over USB and run:

      adb forward tcp:4444 localabstract:/adb-hub

      adb connect localhost:4444

    Note: You can use any available port that you have access to.

    Note: if you get unable to connect to localhost:4444: Connection refused. Try running:

    adb connect 127.0.0.1:4444

    After this if you run adb devices you should see your wearable on the list.