There are some devices that do not support the UI or times when we do not want to create an UI and we prefer to expose a web interface instead. This is possible in Android Things by implementing a simple HTTP Web server. In this paragraph, we will describe how to use a web interface to control the RGB LED string in the same way we did previously. The basic idea that stands behind this is creating an HTML page where the user can set the values to control the LED strip. To do it we have to follow these steps:
- Create a HTTP server to handle the incoming requests.
- Create an HTML page containing all the controls to configure the RGB LED strip.
- Embed the HTTP server into the Android Things app.
Let us describe how to do it.