Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Android Sensor Programming By Example

You're reading from  Android Sensor Programming By Example

Product type Book
Published in Apr 2016
Publisher Packt
ISBN-13 9781785285509
Pages 194 pages
Edition 1st Edition
Languages
Author (1):
Varun Nagpal Varun Nagpal
Profile icon Varun Nagpal

Table of Contents (13) Chapters

Android Sensor Programming By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Sensor Fundamentals 2. Playing with Sensors 3. The Environmental Sensors – The Weather Utility App 4. The Light and Proximity Sensors 5. The Motion, Position, and Fingerprint Sensors 6. The Step Counter and Detector Sensors – The Pedometer App 7. The Google Fit Platform and APIs – The Fitness Tracker App

Time for action – type of step (walking, jogging, and running) detection using the accelerometer sensor


This section is dedicated to the implementation of the type of step detection algorithm discussed in the previous section. Our implementation for the algorithm will consist of four major components of android: first is android service, which will stay in the background, second is a set of two threads using the  ScheduledExecutorService, and third is the activity to show the pedometer application data. The last component is the SQLite database to store the steps' information. The following is the high-level class diagram of the application; we will discuss each class in detail in their own sections. Now, let's explore the first component in detail:

  1. The first component of the algorithm is the StepsTrackerService service, which will remain in the background and provide a container for execution. Inside this service, we create the StepDetectorListener and AccelerometerListener classes and...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}