Developing for Android Wear with Emulators

After a lot of struggle, I finally managed to connect Android Wear running as an emulator to an Android Phone, also running as an emulator. Yes, you read that right! If you don’t have a phone running Android 4.0.3 and above, and no watch either; all is not lost. You can still develop for Android Wear.

Before we go into the details of how to setup your environment, do note that these are settings that work for me and on my work laptop. It may or may not work for you. But I’ll do my best to give you as much detail as possible in the smallest of content write-up that I can. So let’s get started.


My Laptop configuration and details are:

Laptop Brand & Model: Lenovo T420

OS: Windows 7 Enterprise

Processor: Intel Core i7


Graphics: Intel Integrated HD / NVIDIA NVS 4200M


Make sure your SDK is up to date. The version of Android SDK tools I use is 23.0.2 and for Android SDK Platform-tools is 20.


And the Android Virtual image versions are,



My Emulator configurations are:

Phone Emulator:


Notice that I use the Google APIs virtual image instead of the Android Image. I am not sure if it would work without a Google APIs image but my guess would be no, as a lot of Android Wear relies on Google Play Services.  API Level 19 is Android KitKat 4.4.2 which satisfies the minimum required Android version for connecting to an Android Wear device.


Wear Emulator:


Next, you will have to install the Android Wear companion app on your Phone emulator. The version of Android Wear that works for me is


Now, open command prompt (CTRL + R -> ‘cmd’) and change directories to ‘adt-bundle-windows-x86-2014xxxx\sdk\platform-tools’. This is where Android Debugging Bridge (adb) resides and you will need this tool to identify the list of emulators that are tied up to adb itself.

In the command prompt, run the below command:

adb devices


Make sure that the adb shows two emulators in the list. If it does not, then you will have to restart the emulator that is not showing up in the list. You could alternatively try to run the below commands in order and hopefully adb will list both of them this time.

adb kill-server

adb start-server

adb devices

Looking at the window head of your Phone emulator, you can identify the port on which your emulator is running.


My Phone emulator is currently running on port 5554.

In command prompt window, enter the below command to start a telnet session at the port of your Phone emulator

telnet localhost 5554

In the telnet session for this port, enter the below command.

redir add tcp:5601:5601

You should see an ‘OK’ output if all went well. It is important that you type in the characters carefully, as everytime you use the backspace to correct a typo, the telnet command will almost always fail.

Note that you have to set redir for tcp port 5601 every time you start your Phone’s emulator (I would prefer you run this after starting both of them). If at any point, adb loses connection with an emulator, you would be required to do these steps again for the connection to happen.

You can use the below command to list out the redir you just added. However, this step is not required.

redir list

Open the Android Wear companion app on your Phone emulator


Then, click on the Watch-like icon (next to Emulator – Not Connected) to get connected to your Android Wear emulator device.


Look at the Watch emulator, and Voila!


If for some reason the Android Wear emulator does not connect to the Phone emulator, try disconnecting and re-connecting from the Android Wear companion app on the Phone emulator. I have noticed that sometimes clicking anywhere on the Android Wear emulator (which opens the Google Voice Command screen) helps in the detection of the emulator.

Hope you have managed to set your environment with the information provided above. Do give your feedback if you manage to do so. Let me know your difficulties in the comments and I will try to resolve any issues that you face.

All the best developing for Android Wear!


Battery Life on your Android Smartphone

How to Increase your Android Smartphone’s battery-life

Battery life is a primary concern these days where Smartphones and Tablets are used extensively on-the-go. However, this may not be the case once Eesha Khare’s device based on the super capacitor hits the smartphone industry. A super capacitor can be charged in 20-30 seconds and is capable of dispensing 10,000 recharge cycles. Khare has built a super capacitor using a special nanostructure, allowing the device to store a lot more energy per unit volume compared to regular super capacitors. For more details about this achievement, visit here.

If your daily driver is Android (especially with 4.0 and above), I am pretty sure the battery life on your device is driving you nuts. Below are few tips that have been effective in increasing the battery life on my Samsung Galaxy Note N7000. Some of these tips could help you too. To make things easy for you as a reader, I have split this article into two sections: Basic User and Advanced User

Basic User:

1.       Clean-up your home screen:

Do you really require all those fancy widgets on your home screen? Widgets run in the background and continue to update their data based on the frequency that you have configured the app to. You can reduce this rate by going into the settings of some of these widgets (Ex. Weather widget). Keep minimum required widgets only.

Live wallpapers are good to look at but are big battery eaters. Use static wallpapers and preferably darker or black ones on OLED screens where each pixel is self-powered.

If you are using a Samsung or HTC device, you could replace your default launcher (Samsung’s TouchWiz & HTC’s Sense) with Nova Launcher or Apex Launcher. Both these launchers have a free version as well as a paid version available in Google’s Play Store. My personal favourite is Nova Launcher. Samsung and HTC launchers are resource heavy and often tend to lag your smartphone with the wide variety of features they provide. However, replacing your launcher with either Nova or Apex would mean you will lose some of the features directly provided by your smartphone’s manufacturer.

2.       Reduce refresh intervals / turn off unwanted syncing:

The Facebook app is by default set to refresh every one hour. Not every one of us is hooked onto Facebook and some of us receive up to a maximum of 20 notifications per day. Reducing the refresh interval to “4 hours” or “Never” will help converse battery. Push notifications are still received based on your settings and you can manually refresh your timeline by opening the Facebook app.

Avoid sync of Facebook contacts with your phone’s in-built contact manager. Not doing so would lead to frequent connections made with Facebook to update your contacts picture and status messages. Keeping your phone’s data connection active for most of the time would be a major factor to battery drain.

Check all your apps sync settings by going into Settings -> Accounts and clicking on each of the accounts to see their configurations.

3.       Keep your battery at the right temperature:

Your battery operates best at room temperature. I have observed a general temperature range of 26°C to 28°C with my phone sitting in idle. My advice would be not to allow the temperature to rise beyond 40°C. Avoid using your phone while charging as the battery generally gets hotter.

Also, avoid playing games or using CPU intense apps on your phone while plugged-in. This reduces the rate of charging. Though no harm will occur to you battery, the time taken to charge will increase by a large extent. My readings on extended battery life have often pointed out to stick to steady & fast charging for longer battery life. Use original chargers that were provided to you out of the box.

Battery Widget by Elvison is a good app that helps me monitor my battery conditions like Charge Percentage, Temperature and Voltage. You can also utilize the apps alert feature to warn you of critically high temperatures. I would suggest avoiding such an alerting system in place due to another battery hogging factor called wakelocks (explained under Advanced Users section).

4.       Buy paid apps from the developer / Use alternate apps without ad:

Apps with ad support tend to drain more battery by using your mobile’s data connection to retrieve new advertisements to be displayed on your phone. Stick to apps that do not use adware or buy the paid versions which have Google’s ad framework removed inside them. You can use tools like TrustGo Ad Detector to identify apps with advertisements. I would suggest you to uninstall this app after scanning all your apps to avoid an additional service from running in the background at all times.

5.       General Tips:

  • Switch off Wifi / GPS / Bluetooth when not in use.
  • Power saving mode can be effective when running low on battery juice. This mode enables the CPU to run at lower frequencies (MHz), turn off haptic feedback, reduce screen brightness leading to less battery consumption.
  • Enable auto brightness setting for your display to automatically reduce the brightness in low-light areas. However, it would be better to manually set the brightness to the lowest level of comfort for your reading if you utilize your phone in low-light most of the time. This prevents utilization of your phone’s light sensor to detect your environment’s light levels.
  • Switch to GSM only mode when using 2G and GSM / WCDMA (auto mode) when using 3G. In GSM mode, your phone will not supply power to the 3G chip. You can go here by going into Settings -> Mobile Networks -> Network Mode and selecting the desired mode.

Advanced User:

Wake locks are a major cause for battery drain when you drill deep down into the technical aspect of android’s application and event handling. Not to say that wakelocks are bad. They are essential for android to function properly. However, bad programming can lead to unwanted wakelocks arising and draining your phone’s battery quite effectively. With these wakelocks present, your phone is not able to go in to deep sleep mode. This mode saves the maximum amount of power for your battery.

 So, what is a wakelock?

 Apps use wakelocks to keep the CPU running. Android has two types of wakelocks: Kernel and Partial wakelocks; with each category having different number of wakelocks for different hardware components to be accessed by your applications. For example, when you listen to music on your favourite media player, your media player app holds a partial wakelock on the audio output (usually the audioOout_2) and releases it when your application is stopped. Poorly programmed apps or apps running in the background can cause unnecessary partial wakelocks on your phone.

Viber is a well-known application to cause the audioOut_2 partial wakelock for a large count. If you have Viber installed on your android device, uninstall it and reboot your phone. Monitor your battery drain and you should notice a small improvement in your phone’s battery life.

How to find wakelocks created on your phone?

BetterBatteryStats is an amazing app to monitor your device’s wakelocks. You can view the kernel as well as partial wakelocks from Boot, Unplugged and Charged references. You can also set up a custom reference to see the list of wakelocks caused within a given time frame. Some users find this app to be difficult to read and a more user-friendly app is Wakelock Detector. Download and give each app a try to find out which one would work for you.

Below are few wakelock details I have come across and the probable causes and solutions to reduce their occurrences.

Note: It is very difficult to pin-point the exact cause of a wakelock as multiple applications could create the wakelock.


Kernal Wakelocks:

  • l2_hsic
  • secril_fd-interface
  • Multipdp
  • PowerManagerService


Partial Wakelocks:

  •  AudioOut_2





Cause:                                  Unknown

Probable cause:               USB connection lock

Solution:                             1. Restart device to release lock

                                                2. Turn on your phone.

                                                3. Go to the home screen

4. Un-plug device from the charge




Cause:                                  GSM / WCDMA dual mode (3G connections)

Probable cause:               N/A

Solution:                             Switch to GSM for 2G network.

Use Wifi (whenever available) in weak signal locations




Cause:                                  High network usage

Probable Cause:              Fast dormancy enabled for a carrier that does not support it

Solution:                             Using code *#9900#, you can disable fast dormancy option





Cause:                                  Sum of all power related wakelocks

Probable cause:               N/A

Solution:                             N/A




Cause:                                  Any app that uses the device’s audio output

Probable cause:               N/A

Solution:                             Close / Stop app using audio output

Uninstall conflicting apps