Introduction:
Google recently announced the developer preview of Android Things, which is Google’s take on Internet of Things.
Internet of Things refers to the networked interconnection of everyday objects, which are often equipped with some intelligence. IoT will bring man and machine closer (through MMI) by integrating everyday objects for interactions via embedded systems, thus, creating a highly distributed network of devices communicating across a broad spectrum of devices and human beings.
Android Things is Google’s take on Internet of Things. Google has clearly identified focus areas for Android Things that will enable development of connected devices based on Android Things.
Philosophy behind this is that anyone who can develop an android application can also develop application for Android Things. This decision in itself is sure to bring huge developer base directly from Mobile app development to Android Things development, thereby, reducing dependency of learning a new language for IoT development.
Security issues are taken care of in the android core system and the developer need not address concerns pertaining to basic security.
Android Things enables device development for a broad spectrum of users and companies. From creating a small prototype of device to big commercial products, it is all possible with Android Things. Basic philosophy being
Google has provided a wide range of API’s such as, Google Play services which can be leveraged to get going as fast as possible. Some of the services that Google provides are
API’s and interfaces taken directly from google services
System images, updates, fixes so that the complete concentration can be on products.
Pushing Google OS updates and your own app updates.
Example:
Let’s see a simple example of using Android Things to connect a simple Peripheral for a Raspberry pi and control it. We will blink an LED using Raspberry Pi board.
Pre-requisite for using the above example
Hardware Components needed
Create plain android application with below mentioned line in dependencies. Remove all other dependencies if any.
Below is the simple schematic diagram for the example
In build.gradle
Your AndroidManifest.xml activity should look like in snippet below. Notice that although there is a Launcher Activity intent filter, you can see a default Launcher Activity named IOT_LAUNCHER that will be used to launch the activity automatically on boot when our device is booted.
In our main file BlinkActivity.java we need to get the GPIO pin for Raspberry pi (remember we are returning pin for Raspberry pi by default.
That’s it! Just press the “Run” button in your Android studio and you will see your LED blinking.
Source: https://github.com/androidthings/sample-simplepio/blob/master/blink/rpi3_schematics.png