Even though developing wearable apps on a real device is recommended, buying every possible device with different screen shapes for testing purposes would be quite costly. For this reason, testing an app on an emulator is a good idea. The emulator works similarly to a real watch, and it is possible to pair the emulator with a real phone. Continue reading to find out how.
Prerequisites:
– Android SDK (If you have not installed the SDK on your computer, you can download the installation file from here.)
– An Android running Android 4.3 or above, with USB Debugging enabled
– An Android Wear emulator (The emulator can be created using the AVD that comes with the SDK.)
Enabling USB Debugging:
1. On your phone, open the app drawer, and choose Settings.
2. In the Settings screen, scroll down to the bottom, and choose Developer options. If you cannot find this option in the list, go to About device -> tap on the Build Number line five times, go back to the Settings screen, and you will see the missing option there.
3. Next, choose USB debugging.
Note: You have to repeat the whole process whenever you want to connect the emulator to the phone.
1. Create an Android Wear emulator using the AVD that comes with the Android SDK. Once the emulator is created, start it, and connect your phone to the computer.
2. Navigate to the Android SDK’s installation folder -> platform tools, shift + right-click on an empty space, and choose Open command window here.
3. In the command prompt window, type: adb -d forward tcp:5601 tcp:5601. Then hit Enter. If the steps have been successful, your command prompt will look like the example below. If you have a problem, make sure that your phone is connected properly to the computer.
4. Download the official Android Wear app from the Play Store. When the app has downloaded, launch it to establish a connection with the emulator.
5. After following the setup wizard, you need to turn on Bluetooth in order to reveal the extra option for connecting with the emulator. Tap the gear icon at the top right, and choose the Pair with emulator option.
6. It should take a minute for the app to establish a connection with the emulator. You can check the connection status under the device name. You can also check the connection by sending demo cards to the emulator from Settings -> Demo cards. Now that you have successfully paired the two devices, you can start writing apps for Android Wear.