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

The pedometer app's requirements


We will be working on three incremental examples as learning assignments for this chapter. In the first example, we will be using the step counter sensor to show the number of steps taken since the phone was powered on in the activity. In our second example, we will go a little deeper and will discuss how to use the step detector sensor to store the steps information in the SQLite database from the service, and finally we will show the steps history along with the dates of using the activity. Our third example will be an evolved pedometer application that will use the sensor fusion between the step detector and accelerometer sensors to derive advanced functionality of the app. This evolved pedometer application will be highly battery optimized and will automatically track the physical activity (walking, jogging, and fast running) happening in the background. The following is a list of the high level requirements of this pedometer application:

  1. Create a pedometer...