Android Things at Raspberry Pi3
Today I would like to share with you our experience in using Android Things with the world's most popular single board computer Raspberry Pi3.
We always want to be aware of everything that is going on in the mobile world, so trying out Android Things was only a matter of time. Android Things is an operating system for Internet of Things from Google. The idea behind Android Things is to make it easier for us to develop connected embedded devices using the same Android development tools as those used in mobile. Moreover, with Android Things, developers can be responsible both for embedded development and for the mobile app to control the embedded device. Hopefully, it will result in providing a better user experience.
Getting started with Raspberry Pi and this OS is quite simple. All you need is Raspberry itself and a SD card. A screen, keyboards, and other things are optional. First, you should burn Android Things on the SD card. After that, Raspberry Pi will launch every time when you turn it on.
The next step will be connecting this device to the network. For the first connection, you must use Ethernet. Then, after you get IP of the device, you can connect Raspberry to the system and use Android Studio to run builds on this device as usual. Alternatively, you can set up a Wi-Fi connection, so you wouldn't need to connect Raspberry via Ethernet every time.
The process of creating an application for Android Things is pretty straightforward and is similar to the creation of a usual application for Android phone. The only difference is that when launching the application we should choose to support Android Things platform from one of the available options. If you miss those on start, don't worry, you can configure it via Gradle later.
To get the feel of Android Things and Raspberry Pi3, we decided to create an application that can transfer some data from an Android phone to Raspberry and back. We opted to the usage of Nearby Connections API, because it’s really what we wanted in terms of transferring data between two Android devices. It is not just easy to implement, but also really simple and clear for end users that use such system.
Selecting a suitable API didn’t take much time. One of the best things about Android Things is that it supports almost all (if not all) APIs available for the usual Android development. So, you don’t have to spend a lot of time trying to fit new environment, you just make applications like you would do for Android Phone.
With all tools in hands, we have created an application to transfer data from the phone to Raspberry Pi and present it on the screen connected to the platform. The application is very simple, but it gives us an idea of how to use Android Things and create applications for it.
Google plans to develop Android Things in the future and make it a fully feathered platform. At the time of writing this article, there is only 0.6.1-devpreview version available. The main what we’ve got from this experiment is that development of IoT solutions with Android Things is not so different from regular mobile development and is made using the same development tools. Hopefully, we will soon see the final release of Android Things and create some nice products using this platform.