Android Things:Introduction

Md. Tanvir Hossain
Oceanize Lab Geeks
Published in
5 min readDec 29, 2017

Android Things is designed for IoT systems. These may or may not have a display attached. The latest release of Android Things Developer Preview 6 (DP6) has lots of new features and bug fixes. Android Things is Google’s platform that enables Android Developers to create Internet of Things (IoT) devices with support for powerful applications such as video and audio processing and on-board machine learning with TensorFlow.

Hardware

Android Things supports three boards: the Intel Edison, the NXP Pico i.MX6UL and the Raspberry Pi 3. Support is coming for the Intel Joule and the NXP Argon i.MX6UL. The first thing you will notice is that these boards use a mixture of Intel and ARM based CPUs and that both 32-bits and 64-bits are supported. The minimum amount of RAM is 512MB and all the boards support Wi-Fi and Bluetooth.

Booting

The first step is to download the correct Android Things image for your board. For the Pi that means downloading the .img file (which is wrapped up in a .zip file) and writing it to a microSD card. Then you insert the card into the Pi, connect up the monitor (via HDMI) and then connect the power.

Android Things takes about 90 seconds to boot on the Pi 3. First you are shown some boot information (as text) in a similar vain to Linux booting, this is replaced after a few seconds with an Android Things loading screen which shows three pulsating dots (to show that it is working). Finally this is replaced by an Android Thing splash screen, which tells you about the status of the Ethernet and Wi-Fi connections and little else.

A minute and a half is quite a long time for an IoT device to boot, there might be a lots of scenarios were such a long boot time could lead people to think something is broken, especially it the product doesn’t include a display of any kind. Having said that, the level of complexity (and hopefully the abilities) of products based on Android Things will be similar to that of mobile devices rather than “simpler” microcontroller based systems.

IoT launcher

The latest release of Android Things Developer Preview 6 DP6 includes a new IoT launcher that allows the user to see the current state of the device and change settings using a touch screen or USB input devices. Settings such as configuring the WiFi, finding the build ID, and checking for updates is now something that can be done interactively, making it even easier to get started. This launcher is visible when no other developer-provided IOT_LAUNCHER Activity is present.

API 27 and Google Play Services

DP6 is now based on the latest Android 8.1 developer preview, with API level 27. Most of the standard Android samples now work on DP6. For example, the Camera2Basic sample using the Camera2 API and TextureView now works on both NXP and Raspberry Pi based devices (with the hardwareAccelerated flag set to true). Google Play Services has been updated to support SDK version 11.6, supporting all the latest features.

Command-line flashing tool

We heard from developers that flashing and configuring a board using fastboot can be tedious, so the Android Things Console now brings a new and simpler way of flashing device images. Instead of using fastboot and adb commands manually, a new interactive command-line android-things-setup-utility is now provided. This tool makes it much easier to get started with Android Things, and automates the download and flashing process.

Android Things Console updates

DP6 introduces the new partition scheme that will be used for the upcoming production release. Due to the new partition layout, the over-the-air update (OTA) system cannot update existing DP5.1 or earlier devices. Developers will need to go to the Android Things Console, and download and flash a new DP6 build. The Console UI has also been changed for DP6 features, and will only allow you to create new builds based on DP6. If you have any older existing builds, they are still available for download but will not support OTA updates. Developers are encouraged to move all work to DP6.

Peripheral command-line tool

There is a command-line tool pio that gives developers access to the Peripheral API via the adb shell. Developers can interactively test GPIO, PWM, UART, I2C, SPI, and future interfaces from an adb shell, which is useful for debugging and automated testing.

Disadvantages

The key feature of Android Things is that it is based on the normal Android that we know and love. The idea is that Android developers can branch out into IoT and build some interesting products, maybe in conjunction with a mobile app. Or maybe there are existing Android apps that would work well as standalone devices. As a minimum there is lots of code out there that can be reused and repurposed for Android Things.

However this compatibility with Android comes at a cost. The system requirements for Android Things devices are quite high when compared to microcontroller based devices and operating systems like mbed OS. Does my refrigerator really need a quad-core processor and 512MB of RAM?

Of course there are advantages to having such processing power at your finger tips, maybe more computing will occur on the devices (like facial recognition, voice processing and parts of the AI infrastructure). However if these devices end up integrating with the cloud, which they will as they are Internet of Things devices, then there isn’t such a strong case for extra computing power at the point of user interface.

One annoying fact about my time testing Android Things is that the adbconnection kept dropping. I would connect, work with Android Studio, upload the app etc. But then after a few minutes the connection would drop, which meant I was constantly using the command line to re-connect to the board. This obviously isn’t a workable solution in the long term and I hope Google sorts it out.

Conclusion

DP6 includes significant changes and improvements to the platform.To start using DP6, we need to use the Android Things Console to download system images and flash existing devices, or use the android-things-setup-utility. More information about the changes are available in the release notes. You can also join Google's IoT Developers Community on Google+, a great resource to get updates and discuss ideas. Also, we have our new hackster.io community, where everyone can share the amazing projects they have built.

The technology behind Android Things is well established and well known by developers across the world. Together with access to popular hardware platforms like the Raspberry Pi, Android Things could be a winning formula. However the high level of system requirements and the current lack of deployment infrastructure could mean that other platforms offer more for less.

Ultimately time will be the judge, if IoT device makers opt for Android Things then it will be a huge growth market for Google, not in terms of the actual devices, but in terms of the cloud services that these devices use.

--

--