Welcome to code samples for Android Things. Here you will find code snippets and tutorials to help you build embedded applications and integrate hardware peripherals. You can get started with the following samples:
- Simple PIO - Runs basic code that exercises the PIO APIs in Java. Each sample is an Android module that can be run independently.
- Native PIO - Runs basic code that exercises the PIO APIs in C/C++. Each sample is an Android module that can be run independently.
- Simple UI - Basic user interface that represents each GPIO on the board by an interactive switch widget on the display.
- Button - Using a button input driver from the peripheral driver library to listen for GPIO state changes and generate Android key events.
- UART Loopback - Emulates a loopback adapter for the selected UART port. Echoes all data back out the same port.
- Doorbell - Smart doorbell that captures a camera image, analyzes it, and sends it to a companion app using the Google Cloud Platform and Firebase.
- Weather Station - Integration of multiple peripheral sensors to analyze and display current weather information. Data can optionally push to the Google Cloud Platform for further analysis.
- TensorFlow - Demonstrates accessing the camera, performing object recognition and image classification using machine learning, and speaking out the results using text-to-speech (TTS).
- Bluetooth Audio - Enables a Bluetooth device to connect to a peer device and play audio on it (and vice-versa).
- Bluetooth GATT Server - Exposes time information to client Bluetooth devices. The Android client receives a notification when the time is changed on the server.
- USB Enumerator - Iterates over all the USB devices discovered by the host and prints their interfaces and endpoints.
- Edison Candle - Uses an animation API to flicker a pair of LEDs to mimic the behavior of a candle. Includes hardware design files and a bill of materials to assist in building a production device.
- Cloud IoT Sensor Hub - Integration of a motion detector and weather-related peripheral sensors. Data is pushed to the Google Cloud Platform for low-latency messaging.
- Google Assistant API - Demonstrates how to call the Google Assistant gRPC API from a device. Records the spoken request from a connected microphone and plays back the Assistant's spoken response on a connected speaker.
- Drivers - Sample peripheral drivers for Android Things. Includes drivers for an OLED screen, GPS, accelerometer, and more.
You can find additional code samples at the Android Things page on GitHub.