O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mastering Android Wear Application Development

Book Description

Master the future of mobile devices in wearable technology

About This Book

  • Mastering Android Wear Development is a complete guide to wearable technology for experienced Android developers
  • Notifications, voice input, coping with round screens – all the key challenges of wearable technology are covered
  • This book describes not just how to write code for wearables, but also how to think about wearable technology and design apps that work well with the physical limitations of wearable devices

Who This Book Is For

This book is for application developers (the web, mobile, and desktop) who are interested in building new wearable apps, and mobile developers who already have apps on iTunes or Google Play Store and are looking to provide Android Wear support for their existing Android or iOS apps.

What You Will Learn

  • Understand the Wearable computing technology
  • Set up a development environment to build Android Wear apps using Android Studio
  • Master the Android Wear SDK and APIs
  • Understand the UI patterns and UX principles to build Android Wear apps
  • Work with the different form factors of wearable devices (round and square)
  • Take advantage of the sensors available on Android Wear devices
  • Develop Android Wear sample apps
  • Communicate between Android mobile and Android Wear apps
  • Get to know the steps involved in publishing Android Wear apps to the Play store

In Detail

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.

Style and approach

This one-stop professional tutorial will teach you everything you need to know to begin designing and developing applications for this exciting new technology. Every step from development through testing to deployment is explained in depth.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Mastering Android Wear Application Development
    1. Mastering Android Wear Application Development
    2. Credits
    3. About the Authors
    4. About the Reviewer
    5. www.PacktPub.com
      1. Why subscribe?
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    7. 1. Introduction to Wearable Computing
      1. Evolution
      2. Moore's law
      3. Ubiquitous computing
      4. Mobile meets wearables
      5. Hello Android Wear
      6. Summary
    8. 2. Setting up the Development Environment
      1. Android Studio
      2. Installation
      3. Git and GitHub
      4. Gradle
      5. Android SDK packages
      6. Android Virtual Devices
      7. Let's build a skeleton application
      8. Summary
    9. 3. Developing Android Wear Applications
      1. Skeleton app
      2. The Android manifest file
      3. Gradle build files
      4. App activities
      5. Let's build an Android Wear app
      6. Summary
    10. 4. Developing Watch UI
      1. Wearable UI
      2. The Android manifest file
      3. The TodayActivity activity
        1. Actions inside the arrays.xml file
      4. Main activity layout file
      5. The WearableListItemLayout component
      6. The DayOfYearActivity class
        1. The activity_day_of_year.xml file
      7. Summary
    11. 5. Synchronizing Data
      1. What is a companion app anyway?
      2. Setting up an Android Wear virtual device
      3. Revisiting the Today app
        1. Scope of the new Today app
        2. The Wearable data layer API
          1. MessageApi
          2. WearableListenerService
          3. DataListener
          4. Cloud Node
        3. The GoogleApiClient class
        4. The Volley library
        5. The JSoup library
        6. The Build Script
        7. Companion app's Android manifest file
        8. The TodayMobileActivity class
        9. Wearable app's Android manifest file
        10. The OnThisDayActivity class
        11. The HandheldListenerService class
      4. Messages not coming through to your Wear app?
      5. Summary
    12. 6. Contextual Notifications
      1. Getting notified
        1. Core classes of the notifications API
          1. NotificationCompat.Builder
          2. Action buttons in your notification
          3. Wearable-only actions
          4. Delivery
      2. Today app with to-do notifications
        1. Geofencing
        2. Mocking a GPS
        3. The build.gradle file on wear and mobile apps
        4. Handheld app's Android manifest file
        5. The TodoMobileActivity class
      3. To-do list view
      4. Adding to-do items
        1. Mock locations
        2. Mocking locations using FakeGPS app
        3. The GeofenceTransitionIntentService class
        4. Handheld app notification
        5. Wearable app notifications
      5. Summary
    13. 7. Voice Interactions, Sensors, and Tracking
      1. Voice capabilities
        1. System-provided voice actions
        2. App-provided voice actions
      2. New feature - adding to-do items through voice commands
        1. Add to-do Item - a new action in the wearable app
      3. The AddTodoItem activity in the wearable app
      4. Handling speech inputs
      5. Handheld app
      6. Motion sensors
        1. Gyroscope
        2. Accelerometer
      7. New feature - tracking our steps
        1. Add to-do item - a new action in the wearable app
      8. Summary
    14. 8. Creating Custom UI
      1. Android Wear UI design
      2. Common UI patterns
        1. Cards
          1. Countdowns and confirmations
          2. Card stacks
          3. 2D Pickers
        2. Selection lists
      3. Revisiting the OnThisDay activity
        1. The OnThisDayActivity activity
        2. The activity layout
      4. Summary
    15. 9. Material Design
      1. Approaching material design
        1. Interacting with the world
        2. A visual language
      2. To-do item menus
        1. About the navigation drawer
      3. The TodosActivity class
      4. The TodoItemTypeFragment class
      5. The NavigationAdapter class
      6. Navigation item
      7. The WearableDrawerLayout class
      8. Menu items
      9. Menu listener
      10. Switching to-do types
      11. Summary
    16. 10. Watch Faces
      1. Telling the time
        1. What is a watch face?
        2. Design considerations
        3. Implementation considerations
        4. The watch face service
        5. Interactive watch faces
        6. Performance considerations
      2. Let's build a watch face
        1. The Android manifest file
      3. The TodayWatchFace service
      4. The TodayWatchFaceService class
      5. The onTimeTick method
      6. Drawing the watch face
      7. Ambient mode
      8. Customizing the watch face
        1. The WatchFaceConfigActivity class
      9. Summary
    17. 11. Advanced Features and Concepts
      1. Keeping the watch running
        1. Making an app to stay always on
      2. An always running step counter
        1. The Android manifest file
          1. The StepCounterActivity class
      3. Debugging wearable apps
        1. Device setup
          1. USB debugging on the handheld app
          2. Bluetooth debugging on the wearable app
          3. Session setup on the handhelds apps
      4. The way forward - reviewing Android Wear 2.0
        1. Watch face complications
        2. Navigation and action drawers
        3. Expanded and messaging style notifications
        4. The Input Method Framework
        5. Remote input and smart reply
        6. Wrist gestures
        7. Bridging mode
        8. Standalone wearables
      5. Summary
    18. 12. Publishing Apps to Google Play
      1. Testing
        1. The need for testing
        2. Types of unit test
        3. Automating user interface tests
        4. Test APIs
          1. JUnit
          2. The AndroidJUnitRunner class
          3. Espresso
            1. View and Adapter matching
          4. Action APIs
          5. UI Automator
          6. Monkey and monkeyrunner
        5. The human touch
      2. App distribution
        1. Packaging
        2. Publishing and opt-in
      3. Summary