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

Understanding the walking, jogging, and running signatures using the accelerometer sensor's data


The step counter and step detector sensors are really useful, but they fail to provide advanced information on steps, such as what the type of step was (running, jogging, or walking), and what the duration of each step was. For developing an advanced pedometer app or a health and fitness app, the duration and type of step is valuable information. As a learning exercise, we will develop our own algorithm to detect the type of step and the duration of each step. We will use the accelerometer sensor for our algorithm. The accelerometer sensor is the best sensor that can detect motion and acceleration acting on the phone during the walking process. The first step in developing the algorithm is to understand how a step looks on the accelerometer sensor. In the following section, we will be looking at the different signatures of walking, jogging, and running, as seen on the accelerometer sensor's data...