# Android Things

## Summary


Android Things is an operating system released by Google for IoT and embedded devices. It's based on Android, which in turn uses the Linux kernel. It therefore has support for multitasking and virtual memory. It's meant to fit on devices with a limited memory footprint, although 512 MB is the minimum RAM requirement. Android Things therefore targets a different IoT segment compared to microcontroller-based IoT devices. 

For Android developers, building IoT apps will be easier via Android Things. They can use familiar tools and interfaces: Android Studio, Android SDK, Google Play Services, Firebase and Google Cloud. Android libraries including Kotlin and RxJava can be used. In addition, Google certifies compatible System-on-Modules (SoMs) and provides the Board Support Package (BSP). **Android Things Console** will enable managed firmware and app updates to IoT devices.

## Discussion

### Why should I use Android Things for my IoT device?

If you're an Android developer, it's going to be easy getting into IoT app development with Android Things. You can use familiar tools and interfaces, along with Firebase and Google Cloud Platform. Google claims, 

> If you can build an app, you can build a device

Android Things can run on both 32-bit and 64-bit platforms, on both ARM and x86-based processors. Google certifies SoMs that work with Android Things and also provides the necessary BSPs. The modular design of SoMs enables developers to use them on a development board while prototyping and reuse them on any custom carrier board designed for end products. Development boards such as NXP iMX7D and Raspberry Pi 3 are available for fast prototyping. Android Things Console enables easy management of over-the-air (OTA) firmware updates in a secure manner without service interruption. 

At a layer above the OS, **Weave** comes in to enable different devices to communicate using shared schemas. Android Things comes with built-in Weave connectivity. It's to be noted that Weave can be used even without Android Things. 


### How is Android Things different from Android?

Android Things uses the same lower layers of the stack as Android. For the application framework, while some APIs are not available in Android Things, the **Things Support Library** has been added. This library provides low-level hardware access (GPIO, PWM, I2C, SPI, UART, etc.), which is not possible with Android. 

System apps and content providers typical on Android phones are not installed. In general, APIs that are not available are those that require user input or authentication. Displays are optional. There's no Play Store access for users to download and install apps. As developers, you will probably ship Android Things and your apps on your own custom hardware. 


### What's part of the Things Support Library?

There are three parts to this: 

    + **Peripheral I/O API**: Allows apps to access and control sensors and actuators using standard interfaces such as GPIO, PWM, I2C, SPI and UART.
    + **User Driver API**: Allows developers to extend framework services. Apps can inject hardware events that other apps can use via Android APIs. For example, a GPS module can update the framework of current location and other apps can use location manager APIs that are already part of Android.
    + **Cloud IoT Core**: Enables IoT data flow management within Google Cloud Platform.

### How does Android Things compare against MCU-based IoT platforms?

Android Things on a dual-core CPU with 512 MB RAM is not the right pick for just blinking LEDs or collecting and sending few bytes of data. It's better suited for gateways and edge devices that require local processing. Running Machine Learning inferences on the device is a possible use case. 

This also means that Android Things is unsuitable for a range of processors from 8-bit MCUs to 32-bit ARM Cortex M-series cores. Devices powered by Android Things will also consume much more power than MCUs, although they may be better at implementing security. 


### What are the hardware platforms that Android Things supports?

As on May 2018, the following are supported for production: 

    + NXP i.MX8M (ARM Cortex A53, 64-bit + QC7000Lite GPU)
    + Qualcomm SDA212 (ARM Cortex A7, 32-bit + QC Adreno 304 GPU)
    + Qualcomm SDA624 (ARM Cortex A53, 64-bit + QC Adreno 506 GPU)
    + MediaTek MT8516 (ARM Cortex A35, 64-bit)Following are for prototyping and testing only: 

    + NXP i.MX7D (ARM Cortex A7, 32-bit)
    + Raspberry Pi 3 Model B (ARM Cortex A53, 64-bit)We can note that this covers both 32-bit and 64-bit processors. While Intel Edison and Joule platforms support Android Things, the latter's website no longer lists them. NXP i.MX7D is an SoC, and it has an equivalent SoM and development board. 

Both NXP and Intel SoMs include Wi-Fi and Bluetooth for connectivity. Android Things also supports IEEE 802.15.4 for LoWPAN connectivity for which Nordic nRF52840 is a supported platform. 


### What tools and resources are available for working with Android Things?

The following may be a starting point for developers: 

    + Android Studio command line (CL) tools: adb, apkanalyzer, dumpsys, logcat ...
    + android-things-setup-utility: CL tool to flash image
    + Android Things Console: manage images and push updates to devices
    + pio: access Peripheral I/O via adb shell (dev/debug)
    + lowpanctl: access LoWPAN via adb shell (dev/debug)
    + Android Things native library: access Peripheral I/O natively in C/C++ when extra performance is needed
    + Android Things main website and docs
    + Code samples
    + Peripheral Driver Library: open source driver code contributed by community that provide higher-level API on top of Peripheral I/O API
    + Google's IoT Developers Community on Google+
    + Hackster.io/google to get inspired by community projectsWhen using Intel hardware, UPM and MRAA libraries can simplify peripheral I/O interfacing. They offer an alternative to Google's Things Support Library and Peripheral Driver Library. 

## Milestones

2011

Google makes a first attempt with IoT by announcing *Android@Home*, which never took off even as late as 2013. 

May  
2015

Google announces *Brillo* as the operating system for IoT devices. Brillo is derived from Android and uses the latter's lower layers: kernel and hardware abstraction layer. It's supposed that Brillo requires only 32 MB of RAM. This was later claimed to be a 'rumour'. 

Dec  
2016

Google rebrands Brillo as *Android Things*. Android Things is created based on developer feedback on Brillo. Unlike Brillo, which was based on C++, Android Things allows Android developers to code in Java and use familiar tools, interfaces and services they are already used to. 

Dec  
2017

Developer Preview 6.1 is released. It's based on Android 8.1 developer preview, can target apps using API level 27 and supports SDK 11.6. APIs are introduced for LoWPAN. It's clearly stated that this preview may have stability issues. 

Jan  
2018

At CES 2018 in Las Vegas, some vendors showcase products that include Android Things. In general, smart speakers integrate Android Things with Google Assistant while smart displays integrate Android Things with Google Cast. 

Mar  
2018

Developer Preview 7 is released with many new features in Android Things Console. 

May  
2018

Android Things 1.0 is released with long-term support for production devices. This includes support for new SoMs, and configuration and control of Peripheral I/O via Android Things Console. 

Feb  
2019

Google refocuses Android Things as a **platform for OEM partners**. Over the last year, Google has already been working with vendors of smart speakers and smart displays, shipping Android Things with Google Assistant built-in. Therefore, on the public developer platform, there won't be any further support for SoMs based on NXP, Qualcomm, and MediaTek hardware. On the Android Things Console, projects based on NXP i.MX7D and Raspberry Pi 3B will be limited to 100 devices for non-commercial use. 

Jan  
2021

From January 5th, Android Things Console doesn't allow new projects based on NXP i.MX7D and Raspberry Pi 3B. The Console can be used till January 5th, 2022 for existing projects. After that date, all project data include build configurations and factory images will be deleted.