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

Let's build a watch face


It's time to see the concepts, introduced previously, in action. We will build a simple watch face that shows the time using a fairly standard hour, minutes, and seconds display. Tapping the watch face will show the number of days that have elapsed in the current year. A second tap will show the number of days remaining in the current year.

In the subsections that follow, we will define a WatchFaceService class that extends the API CanvasWatchFaceService class and overrides the relevant event handlers that pertain to our sample application.

The Android manifest file

We begin by declaring the TodayWatchFaceService service and the WatchFaceConfigActivity activity, which helps with selecting a background color for the watch:

<!— Required to act as a custom watch face. —> 
<uses-permission android:name="android.permission.WAKE_LOCK" /> 
 
<service 
  android:name=".TodayWatchFaceService" 
  android:label="@string/digital_name" 
  android:permission="android...