Chapter 2. Playing with Sensors

In this chapter, we will learn how to write our first sensor program. We will also understand the various callbacks, and how to use these callbacks in the foreground activity and background service. This chapter will also walk you through a basic algorithm developed using sensor values.

We will cover the following topics in this chapter:

  • Understanding various sensor framework callbacks
  • Using sensors in the foreground activity
  • Listing the available sensors on a device
  • Knowing individual sensors' capabilities
  • Getting the sensor values and updating the user interface
  • Monitoring sensor values in the background service

Understanding the sensor framework callbacks

The two most important callbacks of the sensor framework are the ...

Get Android Sensor Programming By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.