In a presentation that I recently did on Android Wear, one of my challenges was to cast my Samsung Gear Live watch to the audience, so that they can understand the basic working of the device.
Note that these set of instructions also apply in case you are looking at setting up a development environment with a connected Android Phone and Wear Device. So except for the last step, where you have to cast the screen to all, the rest of the steps are the same.
In the past I have done Android trainings in which I have used Droid@Screen utility to do the same and I have a write up on that titled “Project Your Android Screen to All“, if you are interested.
The Android Wear device presented its own little challenges to get things working but I will lay out the precise steps here for you to follow.
Note that these set of instructions also apply in case you are looking at setting up a development environment with a connected Android Phone and Wear Device. So except for the last step, where you have to cast the screen to all, the rest of the steps are the same.
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 that you have paired up with your Android Wear Device. This means that you have setup the Android Wear Play App on your Android Phone.
- You have an Android Wear Device (as of current writing, this means the LG G Watch or the Samsung Gear Live Watch) and it has been paired and setup successfully with your Android Phone.
- You are familiar with basic usage of the Wear device i.e. going to Settings and so on.
I have a Samsung Gear Live device and the instructions will contain screenshots from there but I assume that things will pretty much be the same on the LG G Watch too!
Step 1 : Enable Developer Options 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.
1. Go to Settings on your Wear device
2. Click on Settings and go to About
Note that you will not see the Developer Options item that you are seeing in the menu above if you are doing this for the first time. Since I have already enabled it, that’s why it is visible there. But your goal should be to get this option on your device and that is what is explained next.
3. Go to Build Number list item and tap that 7 times (yes 7 times!).
Once you do that, it will display a message that it has setup Developer options successfully. This should allow you to see the Developer Options in the Settings list.
OK, now let us move over to the Android phone.
Step 2 : Enabling Debugging over Bluetooth on your Android Phone
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. This should bring up a screen as shown below:
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
Our goal is to get both of these in the connected state.
Step 3 : Enable ADB Debugging on your Android Wear Device
Now, switch over to your Android Wear Device.
1. Go to Settings and then Developer Options.
2. Enable that ADB Debugging and Debug over Bluetooth are set to Enabled as shown below. If they are not, just tap on them.
Once you do this, you will see the Debugging over Bluetooth enabled on your Wear Device. This screen will be persistent on your Wear device. So once you are done with your debugging and want to go back to using your watch normally, do disable the ADB Debugging from the Settings->Developer Options->ADB Debugging on your Wear Device to remove this screen.
3. If you look at the Android Phone screen now, it should show the Target as connected, as given below:
In case you find that the Target is remaining in disconnected mode, simply toggle the Debugging over Bluetooth option and it should take effect. I have seen this happen sometimes.
Step 4 : Fire up a few ADB Commands
Great ! We now have to adb forward and adb connect commands to get the Host connected too.
To do this, launch the Command Line (Terminal). This will assume that you have the adb executable present in the PATH. The adb executable will be found typically in the <sdk>/platform-tools folder.
The two commands to give are:
adb forward tcp:6666 localabstract:/adb-hub
and then
adb connect localhost:6666
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. Please give the permission. This will finally, turn the Host also into connected mode and you are now all set.
Step 5 : Verify that both Android Device and Wear Device appear in the ADB devices
You could do that in two ways:
1. You can use the adb devices command to see a list of devices. On my machine, I see the following output:
Romins-MacBook-Pro:~ rominirani$ adb devices
List of devices attached
TA93305YW5 device
localhost:6666 device
The first one is my Android Phone and the other one is the Gear Device.
2. I can also launch the ADB Monitor and see that both the devices are visible:
You can now take screenshots if you want from within this tool itself for any of the devices. Cool, isn’t it ?
Step 6 : Use any of the ADB Screen Casting Tools
We are now in the final lap. We just have to select which casting utility now to use for projecting any of the screens, in this specific case the screen of our wear device.
I have used 2 utilities till now that both do the job and you are free to choose any one of them.
1. Droid @Screen
You can download this utility from here. It provides you a JAR (droidAtScreen-1.1.jar). The version numbers can change over time.
To run this utility, make sure you have Java setup on your machine and that the java executable is available in the PATH. Simply go to the Terminal (Command Line) and give the following command:
java -jar droidAtScreen-1.1.jar
This will bring up a screen which shows both the devices connected as given below:
You can optionally deselect any one of them and simply cast your Wear device as shown below:
2. Android Screen Monitor (ASM)
You can download this utility from here. It provides you a JAR (asm.jar). Thank you to Adam Singer for mentioning this utility.
To run this utility, make sure you have Java setup on your machine and that the java executable is available in the PATH. Simply go to the Terminal (Command Line) and give the following command:
java -jar asm.jar
This will bring up a screen as shown below where you can select which of the two devices you want to cast. We shall select the Wear device setup on localhost:6666.
The utility then starts casting the Wear device as shown below:
Final Comments
I have found both these utilities good enough to do the job but there is one big problem at the moment. Since the bridging is over Bluetooth, there is a severe lag at times before the audience can see the screen refresh. This could potentially create confusion but I am not sure what can be done more to reduce this lag.
In my tests, I found the utilities performing much better on Mac rather than Windows and additionally the ASM utility displayed a much reduced lag as compared to Droid@Screen but you are free to do your own tests.
Let me know via the comments if you find this useful and if you have used other tools that are better and provide a much less lag, I would be happy to learn about that.