• Home
  • >
  • Mobility
  • >
  • A Definitive Guide to Android Wear Application Development – Part 2

A Definitive Guide to Android Wear Application Development – Part 2

  • by Shishir Dubey
  • 2 Years ago
  • 0
Android Wear Application Development

The Android Wear Application Development Process

We introduced you to the initial guide to Android Wear app development in our previous article. Now we will focus on the key concepts so you can get started with your Android Wear development. We’ll also give you information about notifications and Android Wear APIs that you will find useful for Android app development services. So, let’s take a look at them.

Android Wear App Development Using Android Studio

You can use Eclipse or Android Studio as your preferred Integrated Development Environment (IDE) for app development. But, Google suggests that you use Android Studio. You can use the SDK Manager in Android to install API Level 20 (4.4 Kitkat Wear).

Android Studio

You can give Android Wear support to your existing apps. You can also create a new project with Android Studio.

It uses a modular model, under which the Wear and Phone modules are included in the same project.

You can create a new project in Android Studio by clicking on File -> New Project. When it asks you to choose the form factor for your app, you must select the Wear option as well as any other form factor (Class, TV or Phone and Tablet) that you are developing the app for.

The corresponding project is generated based on your selections. It consists of Mobile and Wear modules. The Mobile module runs on a phone and the Wear module runs on an Android Wear device.

You will need to write some code during the tests so that the Android project does what you want the Wear app to do.

You need to package the Mobile and Wear apps together into the app APK. This is because you cannot package the Wear apps separately before is it posted on the Google Play Store.

The Wear app gets automatically transferred to the paired Wear device once your users install the APK on their phone.

Android Wearable APIs for Connection and Data Exchange

You need a specific mechanism, such as the Google Play Services, to establish a connection between the phone and the Wear device.

The two devices can then communicate with each other by exchanging messages. You need to use an instance of GoogleAPIClient to connect them, as shown below:

mGoogleApiClient = new GoogleApiClient.Builder(context)

You can activate the connection between your phone and Wear device active in the relevant Activity Lifecycle method, as shown below:

protected void onStart() {

Similarly, you can disable the connection as shown below:

protected void onStop() {

Once you have activated the connection, you can use different APIs to ensure data communication between the two devices.

Node API

This uses any of the NodeListener interface methods to monitor when the devices are connected or disconnected. It also offers a method to fetch a list of all the connected nodes.

The following is the relevant interface that you should use:

static interface NodeListener {
void onPeerConnected(Node node);
void onPeerDisconnected(Node node);

Message API

This is used to deliver short messages to any of the two devices. The device that receives the message, needs a listener (MessageListener).

This is the applicable data interface:

static interface MessageListener {
void onMessageReceived(MessageEvent messageEvent);

Data API

This offers the sync mechanism on both devices so that they can sync data between them. You must implement the DataListener interface to receive a message.

We suggest that you create an instance of the WearableListenerService interface on both ends. You should then listen for the events that you have a great interest in.

This is the corresponding data layer interface:

static interface DataListener {
void onDataChanged(DataEventBuffer dataEvents);

You can use these Android Wear APIs for many scenarios, such as:

  • To initiate an activity on the wearable device once the phone receives the data.
  • To write apps that are launched and run on the wearable device and to write those that can accept voice input to trigger certain actions.
  • To deliver messages from the wear to the phone to execute an activity or to perform a background function.


Your Wear app users will receive notifications without them having to modify the app, once they have installed the app from the Play Store on their phones that are paired with their Android Wear devices.

You may need to make some changes to the apps so that they are useful on the Wearable device. The notifications may prompt users on a wearable device, on a phone or on both.

You must keep in mind the ways to gain benefits from the UI/background image, notification text, title and more.

If the user gets a notification on their wear device, he or she can swipe it to the left or touch the notification to show the pending action or activity.

Google suggests the NotificationCompat.Builder class if you want handheld notifications to be sent to a wearable device. You need to add a set of such classes, found in the Android Support Library, to your Android project.

We hope that you have found the information about developing Android Wear apps useful! If you have any questions, you can drop us a note below and we’ll get back to you.

  • facebook
  • googleplus
  • twitter
  • linkedin
  • linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

At ChromeInfotech, we have the right team for your needs. If you have a Product Idea, Let us help you bring it to life with our commitment to excellence in technology. We'd love to be a part of your development strategy. Feel Free to get In Touch With Us, Anytime, Anywhere! For You, We are everywhere!

Please choose valid Budget , Its Required


# Block C, Plot No. 260, Sector 63 Noida, UP 201301 India

# +91.98.1060.0971

United States

# 17102 Cortner Ave Cerritos, CA 90703 United States

# +1.408.786.5444


# 2A Follett Street London E14 6LX United Kingdom

# +44.203.784.0573

© 2016 ChromeInfotech | All Rights Reserved