The approach described in the previous chapter works if we want to read the pressure and the temperature one shot. In the project we are developing in this chapter, the app has to read the temperature and the pressure continuously. Therefore, it is convenient to use another approach. This approach is the same strategy we implement in Android when the app needs to monitor the smartphone sensors. As you know, nowadays a smartphone has several built-in sensors and to read their values we use the sensor framework provided by Android SDK.
Just to recap briefly how sensor framework works in Android SDK, we can remember that there are key elements that play an important role in these frameworks. These elements are:
Luckily, these classes and interfaces are also present in Android Things SDK, and they help us to develop smart Android Things apps easily. The following is a brief description of the most...