You are previewing Beginning Android Wearables.
O'Reilly logo
Beginning Android Wearables

Book Description

Although wearable devices have existed since the 70s, they have only recently become mainstream. Google Glass and Android Wear smartwatches, in particular, are relatively new devices that provide countless opportunities for creating innovative apps with unprecedented user experiences. Beginning Android Wearables gives you the skills you need to take part in the wearable revolution and to delight your users by providing the information they need at the tips of their fingers.

This book is very practical and contains many examples that not only show you how to write code for Glass and Android Wear, but also demonstrate how to apply this code in the context of an app.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Author
  8. About the Technical Reviewer
  9. Acknowledgments
  10. Part I: Introduction
    1. Chapter 1: Introducing Android Wearables
      1. Wearables and Contextual Awareness
      2. Wearables and User Experience
      3. Why Android Wearables?
      4. What Can Android Wear Do?
      5. The Context Stream
      6. The Cue Card
      7. The Android Wear App
      8. What Can Glass Do?
      9. Understanding Glass Lingo
        1. Google Glass vs. Glass
        2. Glassware
        3. Glass Explorers
        4. Cards & Timeline
        5. Voice Commands
        6. The MyGlass App
      10. The End of the Glass Explorers Program
      11. Should I Develop for Glass or Android Wear?
      12. Design Matters
      13. Reading This Book
      14. Summary
  11. Part II: Notifications
    1. Chapter 2: Reviewing Notifications for Android
      1. The Example App
      2. Standard Notifications
        1. Always Use a Content Intent
        2. PendingIntents
        3. A Single Top Activity
        4. Implementation
      3. Updating Notifications
        1. Implementation
      4. Notification Priority
      5. Notification Alerts
      6. Notifications in Android 5.0
        1. Dark Content on a Light Background
        2. The Interruption Filter
        3. Notification Category
        4. Lock Screen Notifications
        5. Heads-up Notifications
        6. Changing a Notification’s Color
        7. Compatibility
      7. Rich Notifications
        1. BigTextStyle Notification
        2. BigPictureStyle Notification
        3. InboxStyle Notification
      8. Notification Actions
        1. Implementation
      9. Custom Notifications
        1. Implementation
      10. MediaStyle Notification
        1. Implementing MediaStyleService
        2. Handle the Play and Pause Actions
        3. Implementing MainActivity
      11. Summary
    2. Chapter 3: Customizing Notifications for Wearables
      1. Getting Started
      2. The Example App
      3. Handheld Notifications on Wearables
        1. Standard Notifications
        2. BigTextStyle Notifications
        3. BigPictureStyle Notifications
        4. InboxStyle Notifications
        5. Notification Actions
      4. Customizing Notifications for Wearables
        1. Wielding TaskStackBuilder
        2. Wearable-Only Actions
        3. Notification Pages
        4. Stacking Notifications
        5. Voice Input Notification
        6. Background Only Notifications
        7. Content Action
      5. Summary
  12. Part III: Android Wear
    1. Chapter 4: Running Apps Directly on Android Wear
      1. The Android SDK in Android Wear
      2. Creating a New Project
      3. Starting Wear Apps
        1. App-Provided Voice Actions
        2. System-Provided Voice Actions
      4. The Example App
      5. Example #1: Our First Wearable App
      6. The Wearable UI Library
      7. Our First Wearable UI View: WearableListView
        1. WearableListView and RecyclerView
        2. The ViewHolder Pattern
        3. Example #2: Implementing a List of Strings
        4. Example #3: Implementing an Animated WearableListView
        5. Implementing AnimatedListViewActivity
      8. Example #4: Creating a Timer App
        1. Overview of the Architecture
        2. Implementing TimerUtil
        3. Implementing CommandReceiver
        4. Implementing TimerCompletedActivity
        5. Implementing TimerActivity
      9. Summary
    2. Chapter 5: Android Wear User Interface Essentials
      1. Using CardFragment
        1. The Card Gravity Property
        2. The Card Expansion Property
        3. The Expansion Direction Property
        4. The Expansion Factor Property
      2. Using GridViewPager
      3. Example App #1: Vocab Builder
        1. Representing Vocabulary Words
        2. Representing a Vocabulary Word List
        3. Implementing VocabularyAdapter
        4. Fixed Movement Paging
        5. Creating and Populating GridViewPager
      4. Using CircledImageView
      5. Using DelayedConfirmationView
        1. Using WatchViewStub
        2. Window Overscan
        3. Using ConfirmationActivity
      6. Example App #2: Confirmation Demo
        1. Implementing Action Buttons
        2. Creating a Fragment with an Action Button
        3. Implementing DelayedConfirmationActivity
        4. Implementing ConfirmationDemoActivity
      7. Using BoxInsetLayout
      8. Example App #3: Running Stats
        1. Simulating Running Stats
      9. Implementing RunStatsActivity
      10. Example App #4: Creating a Custom Notification
        1. Creating a Custom Notification
        2. Stopping the Custom Notification
        3. Starting the Custom Notification
      11. Summary
    3. Chapter 6: The Wearable Data Layer API
      1. The Wearable Data Layer
      2. Connecting to GoogleApiClient
        1. Example #1: Establishing an Asynchronous Connection
        2. A Minimal Asynchronous Connection
        3. Establishing a Synchronous Connection
      3. PendingResults
      4. Example #2: Using the Node API
      5. Messages and Data
      6. Example #3: Building a Shared Counter
        1. Implementing the Handheld Activity
        2. Implementing the Wearable Activity
        3. Sending Messages with the Message API
        4. Receiving Messages with the Message API
        5. Request Response Paradigm
      7. The Data API
        1. Implementing the Decrement and Increment Buttons
      8. Example #4: Sending and Receiving Assets
        1. Sending Assets with the Data API
        2. Retrieving Assets with the Data API
      9. Summary
    4. Chapter 7: Creating Custom Watch Faces
      1. The Anatomy of a Watch Face
        1. Interactive and Ambient modes
        2. Low-bit Ambient Mode and Burn-in Protection
        3. Square and Round Screens
        4. The Moto 360 and the Bottom Inset
        5. Interruption Filter
        6. System Indicators
      2. Configuring the Watch Face Style
        1. Status Bar Gravity
        2. Card Peek Mode
        3. Ambient Card Peek Mode
        4. Peek Opacity Mode
        5. Background Visibility
        6. Hotword Indicator Gravity
        7. View Protection
        8. Show System UI Time
      3. Building a Basic Watch Face
        1. Creating and Declaring a Watch Face
        2. Implementing the Engine Class
        3. Scaling the Watch Face to the Current Size
        4. Drawing the Watch Face
      4. Building a Watch Face from Bitmaps
        1. Encapsulating Bitmaps with WatchFaceBitmapHolder
        2. Data Layer Architecture
        3. Implementing ConvergenceUtil
        4. Implementing ConvergenceWearableConfigActivity
        5. Implementing ConvergenceConfigActivity
        6. Implementing ConvergenceWearableListenerService
      5. Implementing ConvergenceWatchFaceService
      6. Summary
  13. Part IV: Google Glass
    1. Chapter 8: Running Apps Directly on Glass
      1. The GDK and the Mirror API
        1. Should I use the Mirror API or the GDK?
      2. Immersions and Ongoing Tasks
        1. Immersions
        2. Ongoing Tasks
        3. Combined Immersion and Ongoing Task
        4. Getting Started
      3. Voice commands
      4. Implementing an Immersion
      5. Using CardScrollView
      6. Playing System Sounds
      7. Implementing Scrolling Cards
      8. Providing Feedback
      9. Summary
    2. Chapter 9: Glass User Interface Essentials
      1. Building Cards Styled for Glass
        1. Declaring a Voice Command
        2. Extending CardScrollAdapter
        3. Creating the List of Scrolling Cards
        4. The TEXT Layout
        5. The TEXT_FIXED Layout
        6. The COLUMNS Layout
        7. The COLUMNS_FIXED Layout
        8. The CAPTION Layout
        9. The TITLE layout
        10. The AUTHOR Layout
        11. The MENU Layout
        12. The ALERT Layout
      2. The Ongoing Task Pattern
        1. LiveCards Require Menus
        2. Publishing LiveCards
        3. Updating LiveCards
        4. Low-Frequency Rendering
        5. High-Frequency Rendering
      3. Implementing a Digital Speedometer
        1. Implementing DigitalSpeedView
        2. Implementing DigitalSpeedMenuActivity
        3. Implementing DigitalSpeedService
        4. Implementing DigitalSpeedRenderer
        5. Implementing RenderThread
      4. Displaying Progress and Status with Slider
      5. Summary
    3. Chapter 10: Gesture and Voice Recognition
      1. Gestures on the Touchpad
        1. Viewing Generic Motion Events
        2. Using GestureDetector
        3. Detecting Gestures and Counting Fingers
        4. Detecting Scrolling on the Touchpad
        5. Implementing Inertial Scroll
      2. Head Gestures
        1. Detecting Head Nods
        2. Implementing HeadGestureDetector
        3. Implementing HeadGestureActivity
      3. Voice Recognition
        1. Voice Command Prompts
        2. Standalone Voice Recognition
        3. Contextual Voice Commands
      4. Summary
    4. Chapter 11: The Camera: Taking Pictures and Recording Video
      1. Taking Pictures and Recording Videos with Intents
        1. Taking Pictures
        2. Recording Videos
      2. Example #1: Capturing Media with Intents
        1. Define a Voice Command
      3. Example #2: Using the Camera API
        1. Implementing CameraUtils
        2. Implementing the SurfaceHolder Callback
        3. Implementing CameraActivity
        4. Initialize the Layout and SoundPool
      4. Example #3: Using the Camera API from a LiveCard
        1. Create LiveCameraPreview
        2. Creating a Menu for the LiveCard
        3. Implement CameraLiveCardService
      5. Example #4: Recording a Time-lapse Video
        1. Implementing TimelapseActivity
        2. Creating an Options Menu
        3. Recording a Time-lapse
      6. Summary
  14. Part V: Android Wear and Glass
    1. Chapter 12: Location and Orientation
      1. Modeling the Earth as an Ellipsoid
      2. Geodetic Latitude and Longitude
      3. Defining Altitude
      4. Location Providers
      5. Obtaining Location Updates on Android Wear
        1. Register for Node and Location Updates
        2. Using FusedLocationProvider
        3. Requesting and Removing Location Updates
      6. Obtaining Location Updates on Glass
        1. Request and Remove Location Updates
      7. Representing Orientation
        1. Coordinate Frames
        2. Azimuth, Pitch, and Roll
        3. Rotation Matrices and Quaternions
      8. Measuring Orientation
      9. The Rotation Vector Sensor
        1. Rotation Vector in Android Wear
        2. Rotation Vector in Glass
      10. Implementing Rotation Vector in Android Wear
      11. Using Rotation Vector on Glass
      12. Building a Compass
        1. True North vs. Magnetic North
        2. Magnetic Interference
      13. Building a Compass in Android Wear
        1. Create a View That Draws a Compass
      14. Implementing CompassActivity
        1. Update the Azimuth and Display Warnings
        2. Obtaining the Declination
      15. Building a Compass in Glass
        1. Implementing CompassView
        2. Obtain the Declination
      16. Using Step Counter in Android Wear
      17. Summary
  15. Index