One of the most typical setups for IoT involves two apps: one for the thing and another one for mobile. It just makes sense to control your IoT device from your phone. With Android Things and Android Studio we can create both apps under the same project, each one being its own module. This setup also allows us to have another common library module that is used by both including areas such as a communication data model.
The big question about having a companion app is about how it should communicate with the IoT device. There are multiple ways to do so. The following three are the most common:
- Hosting a REST API server on the things app and a client on the mobile one
- Firebase Realtime Database integration on both sides
- Nearby communication
Each option...