Android Sensor Programming By Example

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

Android Sensor Programming By Example

Varun Nagpal

3 customer reviews
Take your Android applications to the next level of interactivity by exploring the wide variety of Android sensors
Mapt Subscription
FREE
$29.99/m after trial
eBook
$22.40
RRP $31.99
Save 29%
Print + eBook
$39.99
RRP $39.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$22.40
$39.99
$29.99p/m after trial
RRP $31.99
RRP $39.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Android Sensor Programming By Example Book Cover
Android Sensor Programming By Example
$ 31.99
$ 22.40
OpenCV Android Programming By Example Book Cover
OpenCV Android Programming By Example
$ 23.99
$ 16.80
Buy 2 for $34.30
Save $21.68
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781785285509
Paperback194 pages

Book Description

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

Chapter 1: Sensor Fundamentals
What are sensors?
Motion, position, and environmental sensors
Sensors' coordinate system
Components of the sensor framework
Sensor's sampling period, power, and battery consumption
The reporting modes of sensors
Dealing with specific sensor configuration
Sensor availability based on the Android API level
Best practice for accessing sensors
Summary
Chapter 2: Playing with Sensors
Understanding the sensor framework callbacks
Time for action - using sensors in the foreground activity
Time for action – listing the available sensors on a device
Time for action – knowing individual sensors' capabilities
Time for action – getting the sensor values and updating the user interface
Time for action – processing the sensor values in the background service
What just happened?
Summary
Chapter 3: The Environmental Sensors – The Weather Utility App
The weather utility app's requirements
Understanding environmental sensors
Time for action – using the temperature sensor
Getting air pressure from the phone's pressure sensor
Getting relative humidity from the phone's humidity sensor
Summary
Chapter 4: The Light and Proximity Sensors
Understanding the light and proximity sensors
The automatic torch light and screen brightness app requirements
Time for action – turning the torch light on and off using the proximity sensor
Time for action – adjusting the screen brightness using the light sensor
Wake locks, wakeup sensors, and the FIFO queue
Summary
Chapter 5: The Motion, Position, and Fingerprint Sensors
Understanding motion-based sensors
Understanding position-based sensors
The fingerprint sensor
Time for action – shake detection using the accelerometer sensor
Time for action – the compass using orientation sensor and orientation APIs
Time for action – using the fingerprint sensor
What just happened?
Summary
Chapter 6: The Step Counter and Detector Sensors – The Pedometer App
The pedometer app's requirements
Understanding the step counter and step detector sensors
Time for action – using the step counter sensor in activity
Time for action – maintaining step history with the step detector sensor
Understanding the walking, jogging, and running signatures using the accelerometer sensor's data
Time for action – type of step (walking, jogging, and running) detection using the accelerometer sensor
Summary
Chapter 7: The Google Fit Platform and APIs – The Fitness Tracker App
The Google Fit platform
Platform basics
Authorization and permission scopes
Fitness tracker app using fitness APIs
Fitness tracker application requirements and architecture
Time for action – working with live fitness data using the Sensors API
Time for action – recording fitness data in background using Recording API
Time for action – getting history fitness data using the History API
Summary

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

Authors

Table of Contents

Chapter 1: Sensor Fundamentals
What are sensors?
Motion, position, and environmental sensors
Sensors' coordinate system
Components of the sensor framework
Sensor's sampling period, power, and battery consumption
The reporting modes of sensors
Dealing with specific sensor configuration
Sensor availability based on the Android API level
Best practice for accessing sensors
Summary
Chapter 2: Playing with Sensors
Understanding the sensor framework callbacks
Time for action - using sensors in the foreground activity
Time for action – listing the available sensors on a device
Time for action – knowing individual sensors' capabilities
Time for action – getting the sensor values and updating the user interface
Time for action – processing the sensor values in the background service
What just happened?
Summary
Chapter 3: The Environmental Sensors – The Weather Utility App
The weather utility app's requirements
Understanding environmental sensors
Time for action – using the temperature sensor
Getting air pressure from the phone's pressure sensor
Getting relative humidity from the phone's humidity sensor
Summary
Chapter 4: The Light and Proximity Sensors
Understanding the light and proximity sensors
The automatic torch light and screen brightness app requirements
Time for action – turning the torch light on and off using the proximity sensor
Time for action – adjusting the screen brightness using the light sensor
Wake locks, wakeup sensors, and the FIFO queue
Summary
Chapter 5: The Motion, Position, and Fingerprint Sensors
Understanding motion-based sensors
Understanding position-based sensors
The fingerprint sensor
Time for action – shake detection using the accelerometer sensor
Time for action – the compass using orientation sensor and orientation APIs
Time for action – using the fingerprint sensor
What just happened?
Summary
Chapter 6: The Step Counter and Detector Sensors – The Pedometer App
The pedometer app's requirements
Understanding the step counter and step detector sensors
Time for action – using the step counter sensor in activity
Time for action – maintaining step history with the step detector sensor
Understanding the walking, jogging, and running signatures using the accelerometer sensor's data
Time for action – type of step (walking, jogging, and running) detection using the accelerometer sensor
Summary
Chapter 7: The Google Fit Platform and APIs – The Fitness Tracker App
The Google Fit platform
Platform basics
Authorization and permission scopes
Fitness tracker app using fitness APIs
Fitness tracker application requirements and architecture
Time for action – working with live fitness data using the Sensors API
Time for action – recording fitness data in background using Recording API
Time for action – getting history fitness data using the History API
Summary

Book Details

ISBN 139781785285509
Paperback194 pages
Read More
From 3 reviews

Read More Reviews

Recommended for You

Android Programming for Beginners Book Cover
Android Programming for Beginners
$ 39.99
$ 28.00
Practical Machine Learning Book Cover
Practical Machine Learning
$ 37.99
$ 26.60
Android Security Cookbook Book Cover
Android Security Cookbook
$ 26.99
$ 18.90
Python Machine Learning Book Cover
Python Machine Learning
$ 35.99
$ 25.20
Neural Network Programming with Java Book Cover
Neural Network Programming with Java
$ 35.99
$ 7.20
Learning Android Forensics Book Cover
Learning Android Forensics
$ 39.99
$ 28.00