Book Image

Android Sensor Programming By Example

By : Varun Nagpal
Book Image

Android Sensor Programming By Example

By: Varun Nagpal

Overview of this book

Android phones available in today’s market have a wide variety of powerful and highly precise sensors. Interesting applications can be built with them such as a local weather app using weather sensors, analyzing risky driving behavior using motion sensors, a fitness tracker using step-counter sensors, and so on. Sensors in external devices such as Android Watch, Body Analyzer & Weight Machine, Running Speed Cell, and so on can also be connected and used from your Android app running on your phone. Moving further, this book will provide the skills required to use sensors in your Android applications. It will walk you through all the fundamentals of sensors and will provide a thorough understanding of the Android Sensor Framework. You will also get to learn how to write code for the supportive infrastructure such as background services, scheduled and long running background threads, and databases for saving sensor data. Additionally, you will learn how to connect and use sensors in external devices from your Android app using the Google Fit platform. By the end of the book, you will be well versed in the use of Android sensors and programming to build interactive applications.
Table of Contents (13 chapters)
Android Sensor Programming By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Fitness tracker application requirements and architecture


The following list shows the high-level requirements of the fitness tracker application:

  1. When the application starts for the first time, it should get the following authorizations from the user:
    1. To read their live fitness data with all the read scopes, using the Sensor API.
    2. To record their fitness data with all the read scopes, using Recording API.
    3. To read their fitness history data with all the read scopes, using History API.
  2. The application should list all the available data sources for live data capture using the Sensors API.
  3. The application should capture live data from available data sources. It should also allow adding and removing listeners using the Sensors API.
  4. The application should list all the active subscriptions with their data types using the Recording API.
  5. The application should allow adding and removing of subscriptions for a particular data type using the Recording API.
  6. The application should show the history of available...