Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Android Things Projects
  • Table Of Contents Toc
  • Feedback & Rating feedback
Android Things Projects

Android Things Projects

By : Francesco Azzola
3 (1)
close
close
Android Things Projects

Android Things Projects

3 (1)
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 (9 chapters)
close
close

Invoking the Arduino services


In this paragraph, we will explore how to invoke the Arduino services exposed using the Rest paradigm. In this context, we have to call the services passing the data defined in the user interface exposed by our Android Things app. While in the previous chapter we used the Volley library, in this chapter we will use another library to handle the HTTP connection called OkHTTP (http://square.github.io/okhttp/). In this way, you use another approach and you can select the best one according to your requirements.

The first thing to do is add the library to our build.gradle file:

compile 'com.squareup.okhttp3:okhttp:3.6.0'

Now we can create another class to handle the communication details with the Arduino board:

  1. Create a new class called BoardController.java.
  2. Add a private constructor because this class must be a singleton:
        private BoardController() { client = new 
      OkHttpClient();
        }
        public static BoardController getInstance() { if  
     ...
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Android Things Projects
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon