Android Sensor Programming By Example
eBook - ePub

Android Sensor Programming By Example

  1. 194 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Android Sensor Programming By Example

Book details
Book preview
Table of contents
Citations

About This Book

Take your Android applications to the next level of interactivity by exploring the wide variety of Android sensors

About This Book

  • Get a thorough understanding of the fundamentals and framework of Android sensors.
  • Acquire knowledge of advance sensor programming, and learn how to connect and use sensors in external devices such as the Android Watch, Polar heart rate monitors, Adidas speed cells, and so on.
  • Learn from real-world sensor-based applications such as the Pedometer app to detect daily steps, the Driving app to detect driving events, and the Professional Fitness tracker app to track heart rate, weight, daily steps, calories burned, and so on.

Who This Book Is For

This book is targeted at Android developers who want to get a good understanding of sensors and write sensor-based applications, or who want to enhance their existing applications with additional sensor functionality. A basic knowledge of Android development is required

What You Will Learn

  • Learn about sensor fundamentals, different types of sensors, and the sensor co-ordinate system
  • Understand the various classes, callbacks, and APIs of the Android Sensor framework
  • Check all the available sensors on an Android device and know their individual capabilities—for example, their range of values, power consumption, and so on.
  • Implement sensor fusion using two or more sensors together and learn to compensate for the weakness of one sensor by using the strength of another
  • Build a variety of sensor based, real-world applications such as Weather, Pedometer, Compass, Driving Events Detection, Fitness Tracker, and so on.
  • Get to know about wake up and non-wake up sensors, wake locks, and how to use sensor batch processing along with the sensor hardware FIFO queue
  • Develop efficient battery and processor algorithms using raw sensor data to solve real-world problems
  • Connect to a variety of remote sensors such as body weight measurement and body fat percentage measurement using the Google Fit platform from your Android app

In Detail

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.

Style and approach

A step-by-step and easy-to-follow guide that focuses on utilizing sensors to perform certain tasks. After covering the fundamentals in the first chapter, the book develops the concepts by building a real-world, sensor-based application in subsequent chapters.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Android Sensor Programming By Example by Varun Nagpal in PDF and/or ePUB format, as well as other popular books in Informatica & Programmazione di dispositivi mobili. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781785285509

Android Sensor Programming By Example


Android Sensor Programming By Example

Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2016
Production reference: 1270416
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78528-550-9

Credits

Author
Varun Nagpal
Copy Editor
Angad Singh
Reviewers
Ahmed Mubarak Al-Haiqi
JosĂ© Juan SĂĄnchez Hernández
Project Coordinator
Judie Jose
Commissioning Editor
Ashwin Nair
Proofreader
Safis Editing
Acquisition Editor
Tushar Gupta
Indexer
Mariammal Chettiyar
Content Development Editor
Pooja Mhapsekar
Graphics
Abhinash Sahu
Technical Editor
Vivek Arora
Production Coordinator
Arvindkumar Gupta

About the Author

Varun Nagpal has been developing mobile apps since 2005 and has developed and contributed to more than 100 professional apps and games on various platforms, such as Android, iOS, Blackberry, and J2ME. Android app development has been his main area of expertise, and he has developed apps for a wide variety of Android devices, such as Android phones, tablets, watches, smart TVs, Android Auto, and Google Glass.
He moved to Chicago in late 2013, and since then, he has become a seasoned mobile architect. He has worked in different roles (mobile architect, technical lead, senior developer, and technical consultant) for a variety of various global clients (Allstate, Verizon, AT&T, Sydbank Denmark, SiS Taiwan, Chams PLC Nigeria, and Nandos South Africa) in order to implement their mobile solutions. He has SCJP (Core Java) and SCWD (JSP and Servlets) certifications from Sun Microsystems and MCP (C#) and MCTS (ASP.NET) certifications from Microsoft. You can find his blogs on mobile technology and white papers written by him on his website at http://www.varunnagpal.com/.
When he's not working, Varun can be found meditating or playing the flute. He also loves to develop meditation apps and fun games in his free time. He has developed about 40 meditation apps and games available on Google Play (https://play.google.com/store/apps/developer?id=Creative.Software.Studio) and the Apple App Store (https://itunes.apple.com/us/artist/creative-software-studio/id574745824) under the name of Creative Software Studio, his part-time start-up company (http://creativesoftwarestudio.com/).
I would like to thank my wife, Ankita, for supporting me at every step, and I want to apologize to my one-year-old daughter for not giving her enough time while writing this book. I would also like to acknowledge my parents for their encouragement. Finally, I want to thank the editor, each member of the Packt Publishing team, and the technical reviewers for the effort and enthusiasm they showed while working on this book.

About the Reviewers

Ahmed Mubarak Al-Haiqi received his PhD (he investigated sensor-based side channels on Android) and MEng (in computer and communications engineering) degrees from the National University of Malaysia. Before pursuing his graduate studies, he worked as a database developer for several years with governmental organizations in Aden, Yemen, where he completed a BEng and majored in computer engineering and science. He is currently involved in conducting academic research on mobile security, machine learning, next generation networking trends, as well as interdisciplinary topics.
José Juan Sånchez Hernåndez received an MSc degree in computer science from the University of Almería in 2008. He is a member of the Supercomputing-Algorithms Research Group at the University of Almería, and he is currently working toward a PhD in the area of image coding and transmission.
In his spare time, he enjoys designing and developing native mobile apps for Android, experimenting and making stuff with Arduino and Raspberry Pi, and learning new things. He is also the cofounder of Android AlmerĂ­a Developers Group and an active member of HackLab AlmerĂ­a, where he organizes programming talks and hackathons.
He participated as a mentor in the Google Summer of Code 2015 with the P2PSP organization. You can find out more about him at http://josejuansanchez.org.

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
www.PacktPub.com
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

  • Fully searchable across every book published by Packt
  • Copy and paste, print, and bookmark content
  • On demand and accessible via a web browser

Free access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

Preface

Welcome to Android Sensor Programming By Example. This book will provide you 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. This book will cover a wide variety of sensors available on the Android Platform. You will learn how to write code for the infrastructure (service, threads, database) required to process high volumes of sensor data. This book will also teach you how to connect and use sensors in external devices (such as Android Wear) from the Android app using the Google Fit platform.
You will learn from many real-world sensor-based applications such, as the Pedometer app to detect daily steps, the Weather app to detect temperature, altitude, absolute and humidity, the Driving app to detect risky driving behavior, and the Fitness tracker app to track heart rate, weight, daily steps, and calories burned.

What this book covers

Chapter 1, Sensor Fundamentals, provides you a thorough understanding of the fundamentals and framework of Android sensors. It walks you through the different types of sensors and the sensor coordinate system in detail.
Chapter 2, Playing with Sensors, guides you through various classes, callbacks, and APIs of the Android Sensor framework. It walks you through a sample application, which provides a list of available sensors and their values and individual capabilities, such as the range of values, power consumption, minimum time interval, and so on.
Chapter 3, The Environmental Sensors – The Weather Utility App, explains the usage of various environment sensors. We develop a weather utility app to compute altitude, absolute humidity, and dew point using temperature, pressure, and relative humidity sensors.
Chapter 4, The Light and Proximity Sensors, teaches you how to use proximity and light sensors. It explains the difference between wakeup and non-wakeup sensors and explains the concept of the hardware FIFO sensor queue. As a learning exercise, we develop a small application that turns on/off a flashlight using a proximity sensor, and it also adjusts screen brightness using a light sensor.
Chapter 5, The Mot...

Table of contents

  1. Android Sensor Programming By Example