<img alt="" src="https://secure.leadforensics.com/150446.png " style="display:none;">
Go to top icon

Android Things

Shrijeet Polke Jan 31, 2017

Android Android Things

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.

  • Ease and Power of Android:

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.

  • Rapid prototypes to finished products

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

    • Giving a base to build upon using Turnkey hardware solutions. These hardware like SoC (System on Chip), RAM, wireless radios, etc. are certified to run Android Things.
    • As discussed earlier, the entry barrier to do anything on the platform is few dollars.
    • Enabling scaling from prototype to mass production. The prototypes built are of commercial grade and minimal iterations to bring them to commercial grade mass production.
  • Google Services

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

    • Google API’s and services

API’s and interfaces taken directly from google services

    • System Updates and Support

System images, updates, fixes so that the complete concentration can be on products.

    • Large Scale infrastructure

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

  1. Raspberry-pi
  2. Android Studio 2.2+

Hardware Components needed

  • 1 LED
  • 1 resistor
  • 2 Jumper wires
  • 1 breadboard

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

Schematic diag.png

In build.gradle

Screen Shot 1-1.png

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.

Screenshot.pngThe Android Things example has BoardDefaults.java that returns us board identifier. For our example we always return raspberry are board attached

Screen Shot 2.png
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.

Screen Shot 3.png

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

e-Zest is a leading digital innovation partner for enterprises and technology companies that utilizes emerging technologies for creating engaging customers experiences. Being a customer-focused and technology-driven company, it always helps clients in crafting holistic business value for their software development efforts. It offers software development and consulting services for cloud computing, enterprise mobility, big data and analytics, user experience and digital commerce.