Slide 1

Slide 1 text

Ok Google, Make an Android Things Product Rebecca Franks Android Engineering Lead at DVT Google Developer Expert Android @riggaroo

Slide 2

Slide 2 text

riggaroo.co.za

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Android Things

Slide 7

Slide 7 text

Android Things is an extension of the Android platform for IoT and embedded devices.

Slide 8

Slide 8 text

Interactive Ads Vending Machines Point of Sale Stock Control Retail Cameras Gateways Access Control Smart Meters Business Asset Tracking Fleet Management Driver Assist Predictive Service Logistics Security Systems Smart Doorbells Routers Energy Monitors Home Android Things is ideal for powerful, intelligent devices that need to be secure.

Slide 9

Slide 9 text

Similarities Any other Android library... Android SDK Play Services Firebase Android Studio Cloud Platform

Slide 10

Slide 10 text

Differences No Play Store Deploy OTAs Subset of APIs Custom Hardware Single Purpose Device

Slide 11

Slide 11 text

Applications Launcher Phone Messaging Contacts Calendar Browser Settings Application Framework Activity Manager Window Manager Power Manager Resource Manager XMPP Service Content Providers Wallpapers System UI Package Manager Telephony Manager Location Manager Connectivity Manager View System Runtime Permissions Soft Keyboards Notifications Libraries Surface Manager Media Framework Chromium SSL HAL Audio Manager SQLite Open GL libc Core Libraries Android Runtime (ART) Android Runtime Linux Kernel Display Driver Camera Driver Bluetooth Driver Binder (IPC) Driver USB Driver Audio Driver WiFi Driver Power Management

Slide 12

Slide 12 text

Applications Launcher Phone Messaging Contacts Calendar Browser Settings Application Framework Activity Manager Window Manager Power Manager Resource Manager XMPP Service Content Providers Wallpapers System UI Package Manager Telephony Manager Location Manager Connectivity Manager View System Runtime Permissions Soft Keyboards Notifications Libraries Surface Manager Media Framework Chromium SSL HAL Audio Manager SQLite Open GL libc Core Libraries Android Runtime (ART) Android Runtime Linux Kernel Display Driver Camera Driver Bluetooth Driver Binder (IPC) Driver USB Driver Audio Driver WiFi Driver Power Management

Slide 13

Slide 13 text

Applications Launcher Phone Messaging Contacts Calendar Browser Settings Application Framework Activity Manager Window Manager Power Manager Resource Manager XMPP Service Wallpapers System UI Package Manager Telephony Manager Location Manager Connectivity Manager View System Soft Keyboards Notifications Libraries Surface Manager Media Framework Chromium SSL HAL Audio Manager SQLite Open GL libc Core Libraries Android Runtime (ART) Android Runtime Linux Kernel Display Driver Camera Driver Bluetooth Driver Binder (IPC) Driver USB Driver Audio Driver WiFi Driver Power Management Things Support Library Peripheral I/O Device Management User Drivers Connectivity

Slide 14

Slide 14 text

SoM Architecture Google Managed BSP

Slide 15

Slide 15 text

Distribution with Android Things Android Framework Hardware Libraries Linux Kernel Managed by Google Apps User Drivers Managed by Developers

Slide 16

Slide 16 text

Android Things Console ● Manage your Android Things IoT Product ● Download and install the latest Android Things system image ● Build factory images that contain OEM applications along with the system image ● Push over-the-air (OTA) updates partner.android.com/things/console

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Automatic Security Updates Signed Images Verified Boot A/B Rollback Protection

Slide 22

Slide 22 text

Developing for Android Things

Slide 23

Slide 23 text

Developer Kits NXP I.MX7D Raspberry Pi 3

Slide 24

Slide 24 text

Hardware Integration Peripheral Driver Library - Github + many more... bit.ly/androidthings-github Button GPS PWM Servo RGB LED Strip Temperature Sensor Capacitive Touch Buttons Peripheral I/O - Low Level Access GPIO PWM I2C SPI UART I2S

Slide 25

Slide 25 text

Build a Motion Sensing Camera

Slide 26

Slide 26 text

Motion Sensing Camera

Slide 27

Slide 27 text

Pico i.MX7 Pinout * there was a change in pin naming in DP6

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

//Automatically added in app level build.gradle compileOnly 'com.google.android.things:androidthings:...'

Slide 32

Slide 32 text

//Automatically added in AndroidManifest.xml

Slide 33

Slide 33 text

//Automatically added in AndroidManifest.xml

Slide 34

Slide 34 text

Working with a Motion Sensor

Slide 35

Slide 35 text

GPIO - General Purpose Input / Output - Programmable way to read true / false values (1 or 0) (push button, PIR Sensor) - Write true/false values (LED) - Configurable

Slide 36

Slide 36 text

PIR Sensor

Slide 37

Slide 37 text

Motion Sensor Control

Slide 38

Slide 38 text

//Accessing Sensor Data private val motionSensorGpio: Gpio = PeripheralManagerService().openGpio(motionSensorPin) fun start() { motionSensorGpio.setDirection(Gpio.DIRECTION_IN) motionSensorGpio.setActiveType(Gpio.ACTIVE_HIGH) motionSensorGpio.setEdgeTriggerType(Gpio.EDGE_BOTH) motionSensorGpio.registerGpioCallback(object : GpioCallback() { override fun onGpioEdge(gpio: Gpio): Boolean { if (gpio.value) { motionListener.onMotionDetected() } else { motionListener.onMotionStopped() } return true } }) }

Slide 39

Slide 39 text

//Accessing Sensor Data private val motionSensorGpio: Gpio = PeripheralManagerService().openGpio(motionSensorPin) fun start() { motionSensorGpio.setDirection(Gpio.DIRECTION_IN) motionSensorGpio.setActiveType(Gpio.ACTIVE_HIGH) motionSensorGpio.setEdgeTriggerType(Gpio.EDGE_BOTH) motionSensorGpio.registerGpioCallback(object : GpioCallback() { override fun onGpioEdge(gpio: Gpio): Boolean { if (gpio.value) { motionListener.onMotionDetected() } else { motionListener.onMotionStopped() } return true } }) }

Slide 40

Slide 40 text

//Accessing Sensor Data private val motionSensorGpio: Gpio = PeripheralManagerService().openGpio(motionSensorPin) fun start() { motionSensorGpio.setDirection(Gpio.DIRECTION_IN) motionSensorGpio.setActiveType(Gpio.ACTIVE_HIGH) motionSensorGpio.setEdgeTriggerType(Gpio.EDGE_BOTH) motionSensorGpio.registerGpioCallback(object : GpioCallback() { override fun onGpioEdge(gpio: Gpio): Boolean { if (gpio.value) { motionListener.onMotionDetected() } else { motionListener.onMotionStopped() } return true } }) }

Slide 41

Slide 41 text

LED Control

Slide 42

Slide 42 text

val peripheralManagerService = PeripheralManagerService() ledGpio = peripheralManagerService.openGpio(LED_GPIO_PIN) ledGpio.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW) ledGpio.value = true ledGpio.close()

Slide 43

Slide 43 text

val peripheralManagerService = PeripheralManagerService() ledGpio = peripheralManagerService.openGpio(LED_GPIO_PIN) ledGpio.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW) ledGpio.value = true ledGpio.close()

Slide 44

Slide 44 text

val peripheralManagerService = PeripheralManagerService() ledGpio = peripheralManagerService.openGpio(LED_GPIO_PIN) ledGpio.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW) ledGpio.value = true ledGpio.close()

Slide 45

Slide 45 text

Google Assistant Integration

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

Actions on Google Conversational Actions - Two way dialog - Your action manages the conversation “Ok Google, Talk to Spelling Master” Direct Actions - Google handles the entire user interaction - You only handle the fufilment “Ok Google, Turn off the Motion Sensing Alarm”

Slide 48

Slide 48 text

Smart Home Apps rely on Home Graph Living Room Kitchen Bedroom Office

Slide 49

Slide 49 text

How do you create a Smart Home App?

Slide 50

Slide 50 text

1. Setup OAuth 2.0 Server for account linking ...or fake it for testing :)

Slide 51

Slide 51 text

2. Create actions on Google project console.actions.google.com

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

3. Create an action package, declaring support for Smart Home intents.

Slide 54

Slide 54 text

{ "actions": [{ "name": "actions.devices", "deviceControl": { }, "fulfillment": { "conversationName": "automation" } }], "conversations": { "automation" : { "name": "automation", "url": "https://example.com/google-assistant/endpoint" } } }

Slide 55

Slide 55 text

4. Provide fulfillment of Smart Home intents. (Cloud function)

Slide 56

Slide 56 text

Smart Home - Setup + SYNC

Slide 57

Slide 57 text

Smart Home - EXECUTE Command

Slide 58

Slide 58 text

Smart Home - QUERY Command

Slide 59

Slide 59 text

5. Test and submit your app for approval.

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

Google Assistant Example bit.ly/actions-google Hackster Project: bit.ly/hack-at-motion-camera

Slide 62

Slide 62 text

Examples

Slide 63

Slide 63 text

Edison Candle Dave Smith @devunwired

Slide 64

Slide 64 text

BrailleBox Joe Birch @hitherejoe

Slide 65

Slide 65 text

AI Candy Dispenser Alvaro Viebrantz @alvaroviebrantz

Slide 66

Slide 66 text

Wildlife Detector Paul Trebilcox-Ruiz @PaulTR88

Slide 67

Slide 67 text

Automatic and Secure The Power of Android Managed by Google Summary: Why Android Things?

Slide 68

Slide 68 text

More info: docs bit.ly/androidthings codelab bit.ly/at-codelab

Slide 69

Slide 69 text

Workshop Android Things- Building a Motion Sensing Camera - Tomorrow! 13:00

Slide 70

Slide 70 text

Thank you! Rebecca Franks Android Engineering Lead at DVT @riggaroo