Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Android Things Projects

You're reading from  Android Things Projects

Product type Book
Published in Jun 2017
Publisher Packt
ISBN-13 9781787289246
Pages 232 pages
Edition 1st Edition
Languages
Author (1):
Francesco Azzola Francesco Azzola
Profile icon Francesco Azzola
Toc

Table of Contents (15) Chapters close

Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Getting Started with Android Things 2. Creating an Alarm System Using Android Things 3. How to Make an Environmental Monitoring System 4. Integrate Android Things with IoT Cloud Platforms 5. Create a Smart System to Control Ambient Light 6. Remote Weather Station 7. Build a Spying Eye 8. Android with Android Things

How to implement a web interface


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:

  1. Create a HTTP server to handle the incoming requests.
  2. Create an HTML page containing all the controls to configure the RGB LED strip.
  3. Embed the HTTP server into the Android Things app.

Let us describe how to do it.

Implementing a simple HTTP web server

The first step is implementing a simple HTTP Web server. To do it we will use an interesting project called NanoHttpd (https://github.com/NanoHttpd/nanohttpd). This is a light-weight HTTP server designed to be...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime