Book Image

Mastering Android Wear Application Development

By : Siddique Hameed, Javeed Chida
Book Image

Mastering Android Wear Application Development

By: Siddique Hameed, Javeed Chida

Overview of this book

Wearable technology is the future of mobile devices. It looks set to be a breakthrough technology, just like the iPad was before it. With the Apple Watch being widely regarded as a success, all eyes are now on Google to provide a similar device for its users. Keep your skills ahead of the competition and be one of the first to fully understand this powerful new trend. This book will give you a very solid understanding of the philosophy, thought process, development details, and methodologies involved in building well-designed, robust Android Wear applications. We cover the advantages and disadvantages of the wearable computing paradigm and provide a good foundational knowledge for you to build practical, real-world wearable apps. You will learn about the various tools, platforms, libraries, SDKs, and technology needed to build Android Wear apps. By the end of the book, you will be an expert in building Android wearable apps.
Table of Contents (18 chapters)
Mastering Android Wear Application Development
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface

New feature - tracking our steps


Everyone loves step counters. How about we build one for our wearable device? Not much to talk about here, so let's dive into the code.

Add to-do item - a new action in the wearable app

The first thing we will do here is to add a menu item to the wearable app. Let's call it Step Count. Our changes to arrays.xml file would be as follows:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <string-array name="actions"> 
        <item>Day of Year</item> 
        <item>On this day...</item> 
        <item>Add Todo Item</item> 
        <item>Step Count</item> 
    </string-array> 
</resources> 

This action should now show up on the wearable app, as shown in the following figure:

Click on the Step Count menu item to launch the corresponding StepCounterActivity activity. The code for that class is given here. Note how the activity implements the SensorEventListener class. We hook up...