Book Image

Android Things Projects

By : Francesco Azzola
Book Image

Android Things Projects

By: Francesco Azzola

Overview of this book

Android Things makes developing connected embedded devices easy by providing the same Android development tools, best-in-class Android framework, and Google APIs that make developers successful on mobile. With this book, you will be able to take advantage of the new Android framework APIs to securely build projects using low-level components such as sensors, resistors, capacitors, and display controllers. This book will teach you all you need to know about working with Android Things through practical projects based on home automation, robotics, IoT, and so on. We’ll teach you to make the most of the Android Things and build enticing projects such as a smart greenhouse that controls the climate and environment automatically. You’ll also create an alarm system, integrate Android Things with IoT cloud platforms, and more. By the end of this book, you will know everything about Android Things, and you’ll have built some very cool projects using the latest technology that is driving the adoption of IoT. You will also have primed your mindset so that you can use your knowledge for profitable, practical projects.
Table of Contents (15 chapters)
Title Page
About the Author
About the Reviewers
Customer Feedback

How to develop an Android app that retrieves data from Android Things

In this section, we will cover another integration scenario where an Android app retrieves data from Android Things. While in the previous scenario we used the Android app to control Android Things, here, in this context, we want to retrieve information from sensors connected to the Android Things board. To demonstrate how to do this, we will reuse the project we developed in Chapter 6, Remote Weather Station. To retrieve the data, we have several options, but we are interested in these two following strategies:

  1. Using the MQTT protocol.
  2. Connecting the Android app to Android Things using Bluetooth.

In the first option, in order to retrieve data from sensors, we could implement an Android app that uses MQTT through the Android Things app. As you will remember, in the Remote Weather station project we used MQTT to connect several boards and applications. In this context, we simply have to implement an Android MQTT subscriber...