Until now, we have used I2C sensors and we have implemented a full working project without knowing much about I2C protocol and sensor-specific protocol. This is the power of Android Things: it abstracts the protocol details and we can use I2C sensors developing a normal Android app. This is also possible because we have used an external library in our project. If you remember at the beginning of this project we have included in build.gradle the library to manage the BMP280/BME280 sensor:
As long as we use peripherals that have a library to handle them we do not have to worry about the protocol details. When we use a peripheral that is not directly supported or there is not a library, we have to implement the specific peripheral protocol. In this context, it is important to know how I2C works.