Android Things is Google’s new IOT Android based platform. In essence it’s a slightly altered version of Android which can run on Iot type devices such as the Intel Edison and the Raspberry Pi3.
“Android Things lets you build professional, mass-market products on a trusted platform, without previous knowledge of embedded system design.”
Personally I’m not yet too impressed with Android Things. It is still very new and very raw and is lacking a lot of what you’d expect from an Iot platform. However, having finally a standard Android implementation officially from Google running on these devices has to be a good thing. The platform should just get better from here.
Running in Visual Studio using Xamarin
Of course being Android, Android Things works with Xamarin too. Using Xamarin will also be a benefit for all those awesome cross platform benefits it offers, like sharing your Iot code with your backend services, Android, Ios, Windows Phone, Windows 10, OSX, XBox and whatever other devices you’d like to be supporting in your solution.
Getting the devices to appear in Visual Studio is exactly as you’d expect. The devices will use the standard Android Debugging Bridge (ADB). Plugging in an Intel Edison via USB will be reflected as “Unknown Iot_Edison”. You can obviously also use the network debugging features of ADB. eg. adb connect <ip address> The device will then also be detected in Visual Studio. A Raspberry Pi will appear as “Unknown iot_rpi3”.
Using Xamarin is very simple. All we need to do is bind to the Android Things API Jar to be able to make use of all the features provided by the Android Things SDK. At this moment in time there isn’t an official release Nuget package from Xamarin to do this. It is however very simple to do this yourself. In this sample (and I’ve shared the code on GitHub) I’m binding to the new Dev Preview 2 API for Android Things (androidthings-0.2-devpreview.jar). Once the binding project is referenced from your Android Things project, everything will work as expected. Just of course with the benefit of using C# and not Java!
I’ve created some samples based on the Standard Android Things Samples
No Iot sample and demo is complete without a blinking LED. This sample is a conversion of the Android Things sample.
This sample is a simple illustration of using a UI on an Android Things device. It also illustrates GPIO pins and how to set the high/low values of the pins.
How to install Android Things on your Device: https://developer.android.com/things/preview/index.html
A great article on the basics of electronics and hardware: https://riggaroo.co.za/android-things-hardware-basics/
Happy Android Things Development with Xamarin!