Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
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

Table of Contents (15) Chapters

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

Chapter 8. Android with Android Things

In this chapter, we will cover how to integrate Android with Android Things. The aim of this chapter is to develop two Android apps that interact with Android Things. The convergence between mobile apps and an Internet of things application is an interesting field and we will describe the different strategies we can use to make these two ecosystems exchange data and information. In more detail, the chapter covers:

  1. Different architecture we can use to integrate Android and Android Things.
  2. How to develop an Android app that remotely controls a LED strip we have already built in Chapter 5, Create a Smart System to Control Ambient Light.
  3. How to develop an Android app that shows data coming from sensors through Android Things. This app is a companion app for the Remote Weather station we built in Chapter 6, Remote Weather Station.

In this that chapter, we will re-use all the knowledge we have acquired during this book to build real-life Android and Android Things...

Architecture to connect Android and Android Things


In this paragraph, we will discover how we can integrate Android and Android Things. Nowadays, there are several market products that have a mobile companion app to interact with smart systems. Here are a few of them that we can remember:

  1. Remote controlled smart light systems.
  2. Alarm systems.
  3. Remote controlled appliances.

Therefore, it is important to describe how we can integrate the smartphones ecosystems with Android Things. This section focuses its attention on Android smartphones but you can reuse the same strategies when integrating iOS apps with Android Things.

Generally speaking, there are three different scenarios:

  1. A smartphone controls a smart object (like the Android Things board) (master- slave pattern).
  2. A smartphone receives data stream through the Android Things board.
  3. A smartphone receives notifications from the Android Things system when an event occurs.

We covered the last point in Chapter 2, Creating an Alarm System Using Android...

How to control a LED strip using an Android app


In this first Android project, we want to control an LED strip using an Android app. In more detail, the Android app connects directly to the Android Things app that, in turn, controls one or more LED strips through Arduino boards. As we stated in Chapter 5, Create a Smart System to Control Ambient Light, in this project the Android Things app behaves like a gateway acting as a unique point of access. This approach has several benefits, which were highlighted in Chapter 5, Create a Smart System to Control Ambient Light. In this application context, we exploit the built-in web server implemented in the Android Things app. The idea that stands behind this is to create an Android app that uses the HTTP protocol to remotely control the Android Things app (like a master-slave pattern). To this purpose, we can reuse the Android Things app we have developed and attach to it the Android app. In this way, we can control the Android Things app using...

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...

Summary


Aw we complete this chapter, you have learned how to integrate Android and Android Things. We have explored the different architectures we can use according to the scenario where the apps will work. The knowledge you gained in this chapter can be reused in different scenarios. During this book, we have explored several aspects of Android Things, and different ways we can exploit the power of Android Things OS, integrating with IoT cloud platforms or with other IoT development boards.

lock icon The rest of the chapter is locked
arrow left Previous Chapter
You have been reading a chapter from
Android Things Projects
Published in: Jun 2017 Publisher: Packt ISBN-13: 9781787289246
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}