In my previous tutorial I told you how to set your development environment for Android Wear, create and run a project from Google samples, and how to create Android Wear (AVD).
You can read it here:
You can develop not only Wearable apps with Android Wear SDK, but also you can create apps for smartphones and tablets (we are going to refer to them as handheld devices) that support output of data on Android Wear. We are going to create this kind of application in next tutorial.
In this tutorial we are going to learn how to connect your Android Wear emulator with your handheld device.
Set up the handheld device
1. Download the Android Wear companion app
on your handheld device from Google Play
2. Run the app and allow it access to the location of the device.
3. Enable USB debuging
on your device.
On Android 4.0 and newer
, you can find in here: Setting > Developer options. Please notice:
on Android 4.2 and newer
, Developer options is hidden by default. You can make it available like this: go to Settings > About phone
and tap Build number 7 times
4. Connect your handheld device to the computer with a USB cable
5. Check that your device is connected. For this you can use Android Debugs Bridge(ADB)
- an important command line tool for Android development.For Windows:
Run command prompt
(cmd command in the run menu). Go to the Android SDK folder
command. Then go to platform tools folder
. Now use command:
. That command will list of all plugged Android devices.For Linux:
Open terminal and run adb
command with “device”
flag. I will show how to do it on my system:
It showed that my Nexus 7 is attached.Please notice:
If your list is empty, wait till USB driver is installed.
If your USB driver is installed and list is still empty, use this instruction,(this can occur if you have Windows 8): http://stackoverflow.com/questions/21408674/adb-error-device-not-found
If you want to know more about adb you can check Google documentation: http://developer.android.com/tools/help/adb.html
or read very good tutorial from Vogella:
You can read in my previous tutorial how to create Android Watch emulator (link in the beginning of this post)
Connect handheld device with AVD
- Forward the AVD's communication port to the connected handheld device. You can do it by following command with adb:
Please notice: you need to do it each time you connect hadheld device.
- Run Android Wear app on handheld device, go to Settings and click on "Connect to emulator". (AVD has to be turned on)
- Now AVD and handheld device are connected. You can send notifications, change the appearance of the watch. Go to Settings and choose "Demo cards".
Here you can experiment with different demo cards.The cards you select appear as notifications on the home screen of the emulator. For example, how much time you need to get to home or the current weather.
In this tutorial we connected Android Wear emulator with handheld device and sent sample information to emulator
In next tutorial I will show you how to create your first app for handheld device, which will sent custom notifications on watches. Please don't hesitate to ask any questions and leave feedback. Thank you for reading.
Continue reading to Part 3 - Creating your first app!