Build your own Home using and Android Things A powerful electronics platform running the familiar Android stack with full Java API support Arnav Gupta Co-Founder & Android Mentor @ Coding Blocks THE ANDROID FOR IOT ARCHITECTURE Familiar Android Stack Android Things High Level Overview WHAT BRILLO HAD PROMISED US ? What part is used from Android ? What part is used from Android ? HOW ANDROID THINGS FINALLY PANNED OUT The full Android Stack What is present on Android Things PREPARING FOR THE ANDROID THINGS ADVENTURE Requirement 1: The Board (any one)

• Raspberry Pi 3 • NXP Pico MX6 • NXP Pico MX7 (Recommend this) • Intel Edison • … or crack open an old Android phone you’re not using :P Requirement 2: Lights and Buttons

• 1xLED + 1xButton + Breadboard + Resistors • Or, get a Rainbow Hat Requirement 3: Audio (In & Out)

• Speaker + Mic (if needed, use a 2 to 1 plug) • Protip: Search for “office conference room speakerphones” GET YOUR OPERATING SYSTEM Go to “Android Things Console”

LOL ! Google SEO Fail :P Create a new product

there Select your board Create new factory image Flash it

• For NXP devices, fastboot flash (like you flash Nexus/Motorola devices) • For Raspberry, flash SD Card with Etcher WRITING ANDROID THINGS APPS Tell that this is Android Things Usually you’d want your app to be default and only app What not to use ? Supported Google Unsupported Google APIs Wait a sec . . . Runtime permissions ?

• Normal Permissions = At install time • Dangerous Permissions = After device reboot • No runtime dialog boxes (duh, no display) Cloud IOT Core = The for Android Things LET’S TAKE AN ELECTRONICS CLASS Basic Electronics supported

• GPIO – Digital Inputs and Outputs • PWM – (Fake) Analog Inputs and Outputs • Serial Communication – I2C (Synchronous, Low Speed, 2-wire) – SPI (Synchronous, HighSpeed, multi-wire) – UART (Asynchronous, Only 1 peripheral) GPIO: Active High vs Active Low PWM: Analog using Digital BUTTONS AND LIGHTS The Button driver Using the Button Using the Button Lighting up LED via GPIO THE GOOGLE API https://developers.google.com/assistant/sdk/reference/rpc/

DEMO

Links and Resources

• https://github.com/androidthings • https://github.com/championswimmer/googl e_assistant_iot (This project I demoed) • My Slides: https://speakerdeck.com/championswimmer Weighing Pros and Cons of Android Things • We get > 50% of powerful • Uses a lot of resources (vs Android Stack Linux Kernel + /Cpp bin) • Code sharing with • Dodgy async and multi- Android applications threading (electronics are • Easier to attach ad-hoc UI always sync) • Future: Easy delivery via • Can make similar projects Play Store using JS libs in < 5% code • Google Backing (duh!) • High code complexity trap @championswimmer [email protected] TM 2018 Conference and Deep Dive Sessions April 24-28, IISc Bangalore

Register early and get the best discounts!

@greatindiandev bit.ly/gidslinkedin www.developersummit.com