Debugging Over Bluetooth


 

Getting started with development on the Android Wear platform can be challenging. Here are my notes on how to get started quickly.

Assumptions

  • You have setup the Android SDK on your machine. Specifically, you need to be aware where you have setup your Android SDK and Tools and are aware of the adb command.
  • You have an Android Phone with Android Wear Play App installed on it.
  • You have an Android Wear Device (Moto360, LG G Watch or Samsung Gear Live Watch).

Note:I’m using LG G Watch device and the instructions will contain screenshots of it.

 

android_wear_app android_wear_app2 android_wear_app3 android_wear_app4 android_wear_app5 android_wear_app6 android_wear_app7

 

Enabling debugging on your Android Wear device

If you have setup Developer Options on your Android Phone, the steps to do that on your Wear device is the same.

The first time you set up your watch for remote debugging do the following:

  1. Go to “Settings” on your Wear device and tap it
  2. Scroll down to “About” and tap it. If you see “Developer options” in this list already you do not need to do this procedure since it has already been done.
  3. Scroll down to “Build number” and tap it 7 times. You should get a message that says “You are now a developer!”.
  4. Swipe to the right to get the previous menu
  5. Scroll down to “Developer options” and tap it
  6. Tap “ADB debugging” if it says it is disabled
  7. Tap “Debug over Bluetooth” if it says it is disabled

 

debugging1 debugging2 debugging3 debugging4 debugging5 debugging6

 

Enabling debugging over Bluetooth from your Android phone to your Android Wear device

We are now go setup the debugging over Bluetooth between your Android Phone and Wear Device. To do this, follow these steps:

  1. Launch the Android Wear App on your Android phone.
  2. Go to Settings from the Action Bar.
  3. By default, the option Debugging over Bluetooth will not be selected. Selected that as shown above. This will show the following:
    Host : disconnected
    Target : disconnected
  4. Once you have enabled debugging on your wear, then this will show the following:
    Host : disconnected
    Target : connected

 

android_wear_app8 android_wear_app9

 

Fire up a few ADB Commands

  1. Connect your phone via USB and make sure USB debugging is enabled.
  2. The adb executable will be found typically in the<sdk>/platform-tools folder. Hold Swift & Mouse Right Click and select “Open command window here” from your <sdk>/platform-tools folder.
  3. You can use the adb devices command to see a list of devices.
    adb devices
    Then this will show the following:
    List of devices attached
    30321A4D25DB00EC device

    where in your case this might be different.
  4. To connect ADB to your watch, use the below two commands.
    adb forward tcp:4444 localabstract:/adb-hub
    adb connect localhost:4444

    Please use any other port that you see fit. When you fire the 2nd command, a security confirmation dialog will come up on your phone (older version)/ wear(lastest version). Please give the permission.
  5. To verify the status, use the adb devices command to see a list of devices.
    adb devices
    Then this will show the following:
    List of devices attached
    30321A4D25DB00EC device
    localhost:4444 device

    This time you’ll notice another device has been connected, this is what your wear device.
  6. If everything went right, then check the status of Host in your Android Wear App on your Android phone, then this will show the following:
    Host : connected
    Target : connected

 

debugging_over_bluetooth2

debugging_over_bluetooth3

debugging_over_bluetooth4

debugging7

android_wear_app10

 

Now that you’ve done all of that, Android Studio should give you a dialog like this when you try to run or debug an application:

debugging_over_bluetooth5

For Screen Casting, i’m using droidAtScreen

debugging_over_bluetooth