Android Sensor Programming By Example

Packt Publishing Limited
  • 1. Auflage
  • |
  • erschienen am 29. April 2016
  • |
  • 194 Seiten
E-Book | ePUB mit Adobe DRM | Systemvoraussetzungen
978-1-78528-466-3 (ISBN)
Take your Android applications to the next level of interactivity by exploring the wide variety of Android sensorsAbout This BookGet 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 ForThis 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 requiredWhat You Will LearnLearn about sensor fundamentals, different types of sensors, and the sensor co-ordinate systemUnderstand the various classes, callbacks, and APIs of the Android Sensor frameworkCheck 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 anotherBuild 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 queueDevelop efficient battery and processor algorithms using raw sensor data to solve real-world problemsConnect to a variety of remote sensors such as body weight measurement and body fat percentage measurement using the Google Fit platform from your Android appIn DetailAndroid 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 approachA 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.
  • Englisch
  • Birmingham
  • |
  • Großbritannien
978-1-78528-466-3 (9781785284663)
1785284665 (1785284665)
weitere Ausgaben werden ermittelt
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
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 ( and the Apple App Store ( under the name of Creative Software Studio, his part-time start-up company (
  • Cover
  • Copyright
  • Credits
  • About the Author
  • About the Reviewers
  • Table of Contents
  • Preface
  • Chapter 1: Sensor Fundamentals
  • What are sensors?
  • Types of sensors
  • Types of sensor values
  • Motion, position, and environmental sensors
  • Motion sensors
  • Position sensors
  • Environmental sensors
  • Sensors' coordinate system
  • Android Sensor Stack
  • Components of the sensor framework
  • SensorManager
  • SensorEventListener
  • Sensor
  • SensorEvent
  • Sensor's sampling period, power, and battery consumption
  • The reporting modes of sensors
  • Dealing with specific sensor configuration
  • Checking the availability of the sensor at runtime
  • Declaring the sensor as mandatory feature
  • Sensor availability based on the Android API level
  • Best practice for accessing sensors
  • Summary
  • Chapter 2: Playing with Sensors
  • Understanding the sensor framework callbacks
  • Seeing the big picture
  • Time for action - using sensors in the foreground activity
  • What just happened?
  • Time for action - listing the available sensors on a device
  • What just happened?
  • Time for action - knowing individual sensors' capabilities
  • What just happened?
  • Time for action - getting the sensor values and updating the user interface
  • What just happened?
  • Time for action - processing the sensor values in the background service
  • The phone handling algorithm
  • 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
  • What just happened?
  • Getting air pressure from the phone's pressure sensor
  • Time for action - calculating the altitude using the pressure sensor
  • What just happened?
  • Getting relative humidity from the phone's humidity sensor
  • Time for action - calculating the dew point and absolute humidity
  • What just happened?
  • Time for action - comparing the temperature, humidity, and pressure values from web services to phone sensors
  • Third-party web service - open weather map
  • Using Google Play Services Location API and AsyncTask
  • What just happened?
  • 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
  • What just happened?
  • Time for action - adjusting the screen brightness using the light sensor
  • What just happened?
  • Wake locks, wakeup sensors, and the FIFO queue
  • Wakeup and non-wakeup sensors
  • The sensor's hardware FIFO queue
  • Summary
  • Chapter 5: The Motion, Position, and Fingerprint Sensors
  • Understanding motion-based sensors
  • The accelerometer sensor
  • The gyroscope sensor
  • The gravity sensor
  • The linear acceleration sensor
  • The significant motion sensor
  • Understanding position-based sensors
  • The magnetometer sensor
  • The orientation sensor
  • 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
  • The step counter sensor
  • The step detector sensor
  • Time for action - using the step counter sensor in activity
  • Time for action - maintaining step history with the step detector sensor
  • What just happened?
  • Understanding the walking, jogging, and running signatures using the accelerometer sensor's data
  • The walking signature using the accelerometer sensor
  • The jogging or fast walking signature using the accelerometer sensor
  • The running signature using the accelerometer sensor
  • The type of step detection algorithm
  • Making it battery- and CPU-efficient using sensor fusion
  • Scope for improvement
  • Time for action - type of step (walking, jogging, and running) detection using the accelerometer sensor
  • What just happened?
  • Summary
  • Chapter 7: The Google Fit Platform and APIs - The Fitness Tracker App
  • The Google Fit platform
  • Google Fitness Store
  • Android Fitness APIs
  • Sensors API
  • Recording API
  • History API
  • Sessions API
  • Bluetooth Low Energy API
  • Config API
  • Platform basics
  • Data sources
  • Data types
  • Data point
  • Data set
  • Authorization and permission scopes
  • Registration with the Google developer console
  • Authorization from a user in the application
  • Fitness scopes
  • Installing and running time permissions
  • Fitness tracker app using fitness APIs
  • Fitness tracker application requirements and architecture
  • Time for action - working with live fitness data using the Sensors API
  • What just happened?
  • Time for action - recording fitness data in background using Recording API
  • What just happened?
  • Time for action - getting history fitness data using the History API
  • What just happened?
  • Asynchronous versus synchronous results callback
  • Summary
  • Index

Dateiformat: EPUB
Kopierschutz: Adobe-DRM (Digital Rights Management)


Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).

Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions (siehe E-Book Hilfe).

E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)

Das Dateiformat EPUB ist sehr gut für Romane und Sachbücher geeignet - also für "fließenden" Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein "harter" Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.

Weitere Informationen finden Sie in unserer E-Book Hilfe.

Download (sofort verfügbar)

32,73 €
inkl. 19% MwSt.
Download / Einzel-Lizenz
ePUB mit Adobe DRM
siehe Systemvoraussetzungen
E-Book bestellen

Unsere Web-Seiten verwenden Cookies. Mit der Nutzung dieser Web-Seiten erklären Sie sich damit einverstanden. Mehr Informationen finden Sie in unserem Datenschutzhinweis. Ok