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

Android Wear Projects

Book Description

A fun way to create interesting and cool apps for your Wearable device using Android programming.

About This Book

  • Create real-time Android Wear apps from scratch and become a pro Android Wear Developer
  • Learn to create apps specially dedicated to the Android Wear platform
  • Design custom Wear UIs and create interactive Watch faces

Who This Book Is For

The book is for Android developers with a good understanding of programming and developing applications on Android, but they need not have any experience of creating Wear apps.

What You Will Learn

  • Design and build Wear apps.
  • Learn how to use offline storage in Wear apps.
  • Understand sensors and how to work with them
  • Work with standalone applications of the wear 2.0 API.
  • Create a map application for Android Wear devices
  • Write a watch face and understand more about Wear 2.0
  • Work with firebase realtime database and firebase functions
  • Create a chatting application that has wear companion app

In Detail

Android Wear Projects is your opportunity to step into the exciting new world of Android Wear app development. This book will help you to master the skills in Android Wear programming and give you a complete insight on wear app development.

You will create five different Android Wear apps just like the most popular Android Wear apps. You will create a To-do list, a city maps app, a Wear messenger, Wear fitness tracker and Watch face. While you create these apps you will learn to create custom notifications, receive voice inputs in notifications, add pages to notifications and stack notifications. You will see how to create custom wear app layouts, the custom UIs specially designed for Wear. You will learn to handle and manage data and syncing data with other devices, create interactive Watch faces and also ensure the safety and security of your Wear apps by testing and securing your apps before you deploy them on the app store.

Style and approach

This book will take a project based tutorial style approach where every chapter will create a separate android Wear app and highlight different features of android Wear apps.

Table of Contents

  1. 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. Errata
      3. Piracy
      4. Questions
  2. Getting You Ready to Fly - Setting Up Your Development Environment
    1. Android Wear design principles
      1. Defining layouts
      2. Creating lists
    2. Exploring UI components for Wear devices
      1. Showing confirmations
      2. DelayedConfirmationView
      3. Wear navigation and actions
      4. Navigation drawer
      5. Action drawer
      6. Multifunction buttons
    3. Setting up a development environment for Wear development
      1. Installing Android Studio
    4. Creating your first Android Wear application
      1. Creating your first Wear project
        1. Creating a Wear emulator
          1. Working with actual Wear device
          2. Debugging over Wi-Fi
          3. Enable Bluetooth debugging
    5. Summary
  3. Let us Help Capture What is on Your Mind - WearRecyclerView and More
    1. Getting started
      1. Let's get started by creating a project
        1. Lifecycle of an Android activity
          1. Creating the packages
          2. Creating the SharedPreference utility
          3. Saving notes
          4. Fetching all the saved notes from SharedPreference
          5. Removing notes from SharedPreference
        2. Building the User Interface
        3. Creating an adapter for WearableRecyclerView
          1. Adapter implementation
          2. Working on activities and driving the project towards completion 
        4. Writing a method to create a note when clicking on Add a Note
        5. Adding a method for updating the adapter
        6. Adding the updateData method
        7. Updating the data on the UI when the application restarts
        8. Overriding onActivityResult for getting the delete reference
        9. Let's see DeleteActivity in detail
          1. Note application in a round form factor device
          2. Note application in a square form factor device
    2. Summary
  4. Let us Help Capture What is on Your Mind - Saving Data and Customizing the UI
    1. Wear-note-2
      1. Advantages of Realm
      2. Disadvantages of Realm
      3. Re-structuring the code and dependencies
      4. Working on the Wear User Interface
        1. Let's get started working on the Wear-note-2 user interface
        2. Better fonts for better reading
        3. Writing custom layouts for better UX
    2. Summary
  5. Measure Your Wellness - Sensors
    1. Conceptualizing the application
      1. Enlisting the available sensors in Wear
        1. Accuracy of sensors
        2. Battery consumption
        3. Doze mode
      2. Creating a project
        1. Adding a drawer menu
        2. Creating a navigation drawer adapter
        3. Creating fragments
    2. Summary
  6. Measuring Your Wellness and Syncing Collected Sensor Data
    1. Collecting Wear sensors' data
      1. Completed WearStepService class
        1. Switching back to the Wear module
      2. Conceptualizing the application
        1. Recyclerview Adapter
        2. Completed HistoryActivity Class
    2. Summary
  7. Ways to Get Around Anywhere - WearMap and the GoogleAPIclient
    1. Let's get started with creating WearMap
    2. The Google API console
      1. The Google API client
        1. Configuring the project for functionalities
      2. Getting users' location information with the help of GoogleApiClient
      3. GeoSpatial data using GeoCoder
        1. Infowindow adapter
      4. Custom DialogFragment for taking notes about the location
    3. Configuring SQLite and saving the markers
      1. Schema and contract
    4. Saving data in SQLite
      1. Difference between a standalone map and mobile-synced map application
        1. Identifying the app as standalone
      2. Sharing data between a Wear app and phone app
    5. Detecting your application from another device
      1. Specifying capability names to detect your apps
      2. Detecting and guiding the user to install a corresponding phone app
    6. Keeping your application active on a Wear device
      1. Configuring WAKE_LOCK for your application
    7. Understanding fully interactive mode and lite mode
    8. Summary
  8. Ways to Get Around Anywhere - UI controls and More
    1. Changing marker color and customizing
      1. Dragging the marker and updating the location
      2. InfoWindow click event
      3. The UI controls
    2. Types of Maps
      1. Streetview in Wear application
    3. Best practices
    4. Summary
  9. Let us Chat in a Smart Way - Messaging API and More
    1. Installing Firebase
    2. Conceptualizing the chatting application
      1. Understanding Data Layer
      2. Data Layer events
      3. Capability API
      4. Mobile app implementation
      5. Wear App implementation
    3. Summary
  10. Let us Chat in a Smart Way - Notifications and More
    1. Firebase functions
      1. Messaging service class
    2. Summary
  11. Just a Face for Your Time - WatchFace and Services
    1. The CanvasWatchFaceService class and registering your watch face
    2. The CanvasWatchFaceService.Engine class
    3. Writing your own watch face
      1. Handling tap events and gestures
      2. Supporting different form factors
      3. Understanding watch face elements and initializing them
      4. Common issues
      5. Interactive watch faces
    4. Summary
  12. More About Wear 2.0
    1. Standalone applications
      1. Identifying an app as a standalone
        1. Standalone apps storage
        2. Detecting wear app on another device
        3. Advertise capability
        4. Retrieving the nodes with the required capability
        5. Detecting and guiding the user to install a phone app
        6. Getting just the important information
        7. Cloud messaging
      2. Complications API
        1. Complication data provider
        2. Adding complications to a watch face
        3. Receiving data and rendering complications
        4. Allowing users to choose data providers
        5. User interactions with complications
        6. Permissions for complication data
        7. Opening the provider chooser
        8. Understanding different navigation for wear
        9. Implementation
        10. Single-page navigation drawer
      3. Notifications in wear 2.0
        1. Inline action
        2. Expanded notifications
          1. Best practices for expanded notifications
          2. Bridging mode for notifications
        3. Wear 2.0 input method framework
          1. Invoking input method for wear
      4. Wrist gestures
        1. Best practices for using gestures in apps
          1. Authentication protocols
      5. App distribution
        1. Publish your first wear app
    2. Summary