SlideShare a Scribd company logo
Build your first Android
Things application
Keval Patel
Android Developer @
1
Agenda
- Introduction to Raspberry Pi.
- Specifications & Schematics of Raspberry Pi.
- How to connect Raspberry Pi to your computer?- Create a new project for Android Things.
- What’s different than normal app development?
- Accessing hardware components in Android app.
- Introduction: Smart Switch App
2
What is Raspberry Pi?
3
What is Raspberry Pi?
A computer.
A small single-board computer that plugs into your TV and a keyboard,
which can be used for many of the things that your average desktop does -
spreadsheets, word-processing, games and it also plays high-definition video.
4
What is Raspberry Pi?
Small - Size of the credit card.
Affordable - Just $35!!!
Single Board SoC.
Consumes less than 5W power.
Developed by Raspberry Pi foundation.
Board for the hobbyist.
5
6
Which OS you can run?
- Raspbian OS
- Fedora OS
- Debian OS
- Windows 10
- And now Android...
7
Raspberry Pi 3 Model B
- Released in Feb 2016.
- Costs $35.
- Supports Android Things.
8
Raspberry Pi 3 Model B Specification
- Quad-core 64-bit ARM Cortex-A53, 1.2GHz
- Broadcom VideoCore IV
- 1GB LPDDR2 (900 MHz)
- 10/100 Ethernet
- 2.4GHz 802.11n wireless
- Bluetooth 4.1 and Bluetooth Low Energy
- 40-pin GPIO header
- Ports: HDMI, 3.5mm analog audio-video jack, 4× USB 2.0, Ethernet, Camera
Serial Interface (CSI), Display Serial Interface (DSI) 9
10
GPIO
- GPIO = General Purpose Input Output.
- You can configure that pin to act as
input or output pin at runtime.
- No predefined purpose, and go unused
by default.
- Raspberry Pi has 40 GPIO pins.
- The pins allow us to interact with
different components and receive and
send information to them. 11
GPIO Pin Diagram
12
How to connect with Raspberry Pi?
13
How to connect with Raspberry Pi?
1. Connect USB cable for power.
2. Connect an Ethernet cable your local network.
3. Connect an HDMI cable to an display. (Optional)
4. Find the IP of Raspberry Pi using IP scanner tool. (e.g.
Angry IP scanner.) The host name will be “Android.local”.
5. Connect to this IP address using the adb.
$ adb connect <ip-address>
connected to <ip-address>:5555
14
How to connect with Wi-Fi?
1. Send an intent to the Wi-Fi service with the SSID and passcode of your Wi-Fi
network. You need to do it only when connecting to new Wi-Fi network.
$ adb shell am startservice 
-n com.google.wifisetup/.WifiSetupService 
-a WifiSetupService.Connect 
-e ssid <Network_SSID> 
-e passphrase <Network_Passcode>
$ adb connect <ip-address>
connected to <ip-address>:5555
2. Find the IP of Raspberry Pi using IP scanner tool.
3. Connect to this IP address using the adb.
15
How to check if the internet access available?
rpi3:/ $ ping google.com
PING google.com (216.58.199.142) 56(84) bytes of data.
16
Creating
Android Things
Project In
Android Studio
17
Build Android Things Project
- Create new android project.
18
Build Android Things Project
- Set the minSdkVersion for the project to 24.
19
Build Android Things Project
- Add “com.google.android.things” library to “AndroidManifest.xml”.
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<uses-library android:name="com.google.android.things"/>
<activity android:name=".MainActivity">
....
....
</activity>
</application>
20
Add Home activity support
- "Home activity" in its manifest as the main entry point for the system to
automatically launch on boot.
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Launch activity automatically on boot -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.IOT_LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
21
Android Things
Vs.
Android Phone
22
Android Things App Vs. Phone App
- In Android Things UI is optional.
- Android Things launcher does not
have an app drawer. You need to
launch the application using ADB.
- There is no system-wide status
bar and window shade in Android
Things. So, notifications are not
supported.
- No system-wide navigation bar.
So, back button, home button, and
app switcher are supported. 23
Android Things App Vs. Phone App
- Android Things supports a subset of the Google APIs for Android.
- Each release of Android Things bundles the latest stable version of Google
Play Services, and requires at least version 10.0.0 of the client SDK.
24
- No runtime permission. Just declare permission in AndroidManifest. (Just like
old days!!!)
- No support for the Google Play.
Android Things App Vs. Phone App
- Doesn't include the all of the standard system apps and content providers.
Like SMS application and SMS provider. Avoid using them.
25
How to access GPIO?
26
Setting GPIO
- Open GPIO pin using PeripheralManagerService.
PeripheralManagerService service = new PeripheralManagerService();
mRedPin = service.openGpio(BoardDefaults.getGPIOForRedLED());
- Define pin as input or output.
//Define as output
mRedPin.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW);
//Or
mRedPin.setDirection(Gpio.DIRECTION_OUT_INITIALLY_HIGH);
//Set as input
mRedPin.setDirection(Gpio.DIRECTION_IN);
27
Peripheral Driver Library
- There are many sensors we may need in our project.
- All sensors have different specs and different types of
input/output.
- You don’t want to write code to integrate those sensors
in your application.
- Peripheral Driver Library contains pre-written user
drivers for popular peripherals available for supported
Android Things hardware.
- It is open sourced.
(https://github.com/androidthings/contrib-drivers) 28
Let’s build something REAL!!!
29
Smart Switch
30
Control the devices like fan, light bulb using your phone.
- Can control 1 fan, 1 light bulb and 1 LED.
- Uses firebase real-time database to sync the
status of the home device between raspberry pi
and companion app.
Components required
- Raspberry Pi
31
- 2 x 5V Relay
- 1 LED
- 1K resistor
- Breadboard
- Wires/Connectors
32
33
Firebase Real Time
Database
It’s demo time!!!
34
What’s next???
35
- Go ahead and download from GitHub (https://goo.gl/1CHzrB). Play with your
own devices.
- Try out different samples from Android Things samples
(https://goo.gl/aTRWTN) page.
- Make your own project.
References
36
- Android Things - Android Developers (https://goo.gl/PefyPY)
- Android Things - GitHub (https://goo.gl/AWA1Co)
- Android Things – Hardware Basics for the Software Engineer
(https://goo.gl/ini66V)
- SmartSwitch - Github (https://goo.gl/1CHzrB)
What you are going to build
now?
@kevalpatel2106
@multidots
37

More Related Content

What's hot

Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Codemotion
 
Windows 10 IoT Core, a real sample
Windows 10 IoT Core, a real sampleWindows 10 IoT Core, a real sample
Windows 10 IoT Core, a real sample
Mirco Vanini
 
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldAndroid Things, from mobile apps to physical world
Android Things, from mobile apps to physical world
Stefano Sanna
 
Hack the Real World with ANDROID THINGS
Hack the Real World with ANDROID THINGSHack the Real World with ANDROID THINGS
Hack the Real World with ANDROID THINGS
DevFest DC
 
Myths of Angular 2: What Angular Really Is
Myths of Angular 2: What Angular Really IsMyths of Angular 2: What Angular Really Is
Myths of Angular 2: What Angular Really Is
DevFest DC
 
Windows 10 on Raspberry PI 2
Windows 10 on Raspberry PI 2Windows 10 on Raspberry PI 2
Windows 10 on Raspberry PI 2
Mirco Vanini
 
Android Things Robocar with TensorFlow for object recognition
Android Things Robocar with TensorFlow for object recognitionAndroid Things Robocar with TensorFlow for object recognition
Android Things Robocar with TensorFlow for object recognition
DevFest DC
 
Hacking with the Raspberry Pi and Windows 10 IoT Core
Hacking with the Raspberry Pi and Windows 10 IoT CoreHacking with the Raspberry Pi and Windows 10 IoT Core
Hacking with the Raspberry Pi and Windows 10 IoT Core
Nick Landry
 
Project Ara
Project AraProject Ara
Project Ara
Opersys inc.
 
Google I/O 2018 Extended, Baghdad - Flutter
Google I/O 2018 Extended, Baghdad  - FlutterGoogle I/O 2018 Extended, Baghdad  - Flutter
Google I/O 2018 Extended, Baghdad - Flutter
AbdElmomenKadhim
 
Flutter 1
Flutter 1Flutter 1
Flutter 1
Warren Lin
 
Flutter Intro
Flutter IntroFlutter Intro
Flutter Intro
Vladimir Parfenov
 
Cross-Platform App Development with Flutter, Xamarin, React Native
Cross-Platform App Development with Flutter, Xamarin, React NativeCross-Platform App Development with Flutter, Xamarin, React Native
Cross-Platform App Development with Flutter, Xamarin, React Native
Korhan Bircan
 
Customize and control connected devices
Customize and control connected devicesCustomize and control connected devices
Customize and control connected devices
Codemotion
 
C language in our world 2017
C language in our world 2017C language in our world 2017
C language in our world 2017
Juraj Michálek
 
Development of Mobile Applications
Development of Mobile ApplicationsDevelopment of Mobile Applications
Development of Mobile Applications
Dávid Kaya
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
Bartosz Kosarzycki
 
Android Open Accessory APIs
Android Open Accessory APIsAndroid Open Accessory APIs
Android Open Accessory APIs
Pearl Chen
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
Karim Yaghmour
 
[Alexandria Devfest] the magic of flutter
[Alexandria Devfest] the magic of flutter[Alexandria Devfest] the magic of flutter
[Alexandria Devfest] the magic of flutter
Ahmed Abu Eldahab
 

What's hot (20)

Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
Android Things, from mobile apps to physical world by Giovanni Di Gialluca an...
 
Windows 10 IoT Core, a real sample
Windows 10 IoT Core, a real sampleWindows 10 IoT Core, a real sample
Windows 10 IoT Core, a real sample
 
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldAndroid Things, from mobile apps to physical world
Android Things, from mobile apps to physical world
 
Hack the Real World with ANDROID THINGS
Hack the Real World with ANDROID THINGSHack the Real World with ANDROID THINGS
Hack the Real World with ANDROID THINGS
 
Myths of Angular 2: What Angular Really Is
Myths of Angular 2: What Angular Really IsMyths of Angular 2: What Angular Really Is
Myths of Angular 2: What Angular Really Is
 
Windows 10 on Raspberry PI 2
Windows 10 on Raspberry PI 2Windows 10 on Raspberry PI 2
Windows 10 on Raspberry PI 2
 
Android Things Robocar with TensorFlow for object recognition
Android Things Robocar with TensorFlow for object recognitionAndroid Things Robocar with TensorFlow for object recognition
Android Things Robocar with TensorFlow for object recognition
 
Hacking with the Raspberry Pi and Windows 10 IoT Core
Hacking with the Raspberry Pi and Windows 10 IoT CoreHacking with the Raspberry Pi and Windows 10 IoT Core
Hacking with the Raspberry Pi and Windows 10 IoT Core
 
Project Ara
Project AraProject Ara
Project Ara
 
Google I/O 2018 Extended, Baghdad - Flutter
Google I/O 2018 Extended, Baghdad  - FlutterGoogle I/O 2018 Extended, Baghdad  - Flutter
Google I/O 2018 Extended, Baghdad - Flutter
 
Flutter 1
Flutter 1Flutter 1
Flutter 1
 
Flutter Intro
Flutter IntroFlutter Intro
Flutter Intro
 
Cross-Platform App Development with Flutter, Xamarin, React Native
Cross-Platform App Development with Flutter, Xamarin, React NativeCross-Platform App Development with Flutter, Xamarin, React Native
Cross-Platform App Development with Flutter, Xamarin, React Native
 
Customize and control connected devices
Customize and control connected devicesCustomize and control connected devices
Customize and control connected devices
 
C language in our world 2017
C language in our world 2017C language in our world 2017
C language in our world 2017
 
Development of Mobile Applications
Development of Mobile ApplicationsDevelopment of Mobile Applications
Development of Mobile Applications
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
 
Android Open Accessory APIs
Android Open Accessory APIsAndroid Open Accessory APIs
Android Open Accessory APIs
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 
[Alexandria Devfest] the magic of flutter
[Alexandria Devfest] the magic of flutter[Alexandria Devfest] the magic of flutter
[Alexandria Devfest] the magic of flutter
 

Similar to Build your first android things application

Building your own RC Car with Raspberry Pi
Building your own RC Car with Raspberry PiBuilding your own RC Car with Raspberry Pi
Building your own RC Car with Raspberry Pi
Jeff Prestes
 
Internet of things aktu lab file
Internet of things  aktu lab fileInternet of things  aktu lab file
Internet of things aktu lab file
Nitesh Dubey
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
Advanced view of projects raspberry pi list raspberry pi projects
Advanced view of projects raspberry pi list   raspberry pi projectsAdvanced view of projects raspberry pi list   raspberry pi projects
Advanced view of projects raspberry pi list raspberry pi projects
WiseNaeem
 
Advanced view of projects raspberry pi list raspberry pi projects
Advanced view of projects raspberry pi list   raspberry pi projectsAdvanced view of projects raspberry pi list   raspberry pi projects
Advanced view of projects raspberry pi list raspberry pi projects
WiseNaeem
 
Introduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin ControlIntroduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin Control
Pradip Bhandari
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
5 IOT MODULE 5 RaspberryPi Programming using Python.pdf5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
Jayanthi Kannan MK
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
Raspberry Pi Introductory Lecture
Raspberry Pi Introductory LectureRaspberry Pi Introductory Lecture
Raspberry Pi Introductory Lecture
Syed Umaid Ahmed
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
Android Things - The IoT platform from Google
Android Things - The IoT platform from GoogleAndroid Things - The IoT platform from Google
Android Things - The IoT platform from Google
Emmanuel Obot
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi [Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
Tomomi Imura
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
WiseNaeem
 
Node red for Raspberry Pi
Node red for Raspberry PiNode red for Raspberry Pi
Node red for Raspberry Pi
Anshu Pandey
 
Raspberry pi pico projects raspberry pi projects
Raspberry pi pico projects raspberry pi projectsRaspberry pi pico projects raspberry pi projects
Raspberry pi pico projects raspberry pi projects
Ismailkhan77481
 
An introduction to workflow-based programming with Node-RED
An introduction to workflow-based programming with Node-REDAn introduction to workflow-based programming with Node-RED
An introduction to workflow-based programming with Node-RED
Boris Adryan
 

Similar to Build your first android things application (20)

Building your own RC Car with Raspberry Pi
Building your own RC Car with Raspberry PiBuilding your own RC Car with Raspberry Pi
Building your own RC Car with Raspberry Pi
 
Internet of things aktu lab file
Internet of things  aktu lab fileInternet of things  aktu lab file
Internet of things aktu lab file
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
 
Advanced view of projects raspberry pi list raspberry pi projects
Advanced view of projects raspberry pi list   raspberry pi projectsAdvanced view of projects raspberry pi list   raspberry pi projects
Advanced view of projects raspberry pi list raspberry pi projects
 
Advanced view of projects raspberry pi list raspberry pi projects
Advanced view of projects raspberry pi list   raspberry pi projectsAdvanced view of projects raspberry pi list   raspberry pi projects
Advanced view of projects raspberry pi list raspberry pi projects
 
Introduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin ControlIntroduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin Control
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
 
5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
5 IOT MODULE 5 RaspberryPi Programming using Python.pdf5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
5 IOT MODULE 5 RaspberryPi Programming using Python.pdf
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
 
Raspberry Pi Introductory Lecture
Raspberry Pi Introductory LectureRaspberry Pi Introductory Lecture
Raspberry Pi Introductory Lecture
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
 
Android Things - The IoT platform from Google
Android Things - The IoT platform from GoogleAndroid Things - The IoT platform from Google
Android Things - The IoT platform from Google
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
 
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi [Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
[Forward4 Webinar 2016] Building IoT Prototypes w/ Raspberry Pi
 
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdfAdvanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
Advanced View of Projects Raspberry Pi List - Raspberry PI Projects.pdf
 
Node red for Raspberry Pi
Node red for Raspberry PiNode red for Raspberry Pi
Node red for Raspberry Pi
 
Raspberry pi pico projects raspberry pi projects
Raspberry pi pico projects raspberry pi projectsRaspberry pi pico projects raspberry pi projects
Raspberry pi pico projects raspberry pi projects
 
An introduction to workflow-based programming with Node-RED
An introduction to workflow-based programming with Node-REDAn introduction to workflow-based programming with Node-RED
An introduction to workflow-based programming with Node-RED
 

More from Keval Patel

Contributor Qualities
Contributor QualitiesContributor Qualities
Contributor Qualities
Keval Patel
 
Views and environment of management
Views and environment of management Views and environment of management
Views and environment of management
Keval Patel
 
White revolution
White revolutionWhite revolution
White revolution
Keval Patel
 
Control of dc drives
Control of dc drivesControl of dc drives
Control of dc drives
Keval Patel
 
Wave guide tees
Wave guide teesWave guide tees
Wave guide tees
Keval Patel
 
Demand forecasting
Demand forecastingDemand forecasting
Demand forecasting
Keval Patel
 
Various types of data recorders
Various types of data recordersVarious types of data recorders
Various types of data recorders
Keval Patel
 
Transition from 1G to 4G
Transition from 1G to 4GTransition from 1G to 4G
Transition from 1G to 4G
Keval Patel
 
Log periodic antenna
Log periodic antennaLog periodic antenna
Log periodic antenna
Keval Patel
 
Dsp application on mobile communication
Dsp application on mobile communicationDsp application on mobile communication
Dsp application on mobile communication
Keval Patel
 

More from Keval Patel (10)

Contributor Qualities
Contributor QualitiesContributor Qualities
Contributor Qualities
 
Views and environment of management
Views and environment of management Views and environment of management
Views and environment of management
 
White revolution
White revolutionWhite revolution
White revolution
 
Control of dc drives
Control of dc drivesControl of dc drives
Control of dc drives
 
Wave guide tees
Wave guide teesWave guide tees
Wave guide tees
 
Demand forecasting
Demand forecastingDemand forecasting
Demand forecasting
 
Various types of data recorders
Various types of data recordersVarious types of data recorders
Various types of data recorders
 
Transition from 1G to 4G
Transition from 1G to 4GTransition from 1G to 4G
Transition from 1G to 4G
 
Log periodic antenna
Log periodic antennaLog periodic antenna
Log periodic antenna
 
Dsp application on mobile communication
Dsp application on mobile communicationDsp application on mobile communication
Dsp application on mobile communication
 

Recently uploaded

top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 

Recently uploaded (20)

top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 

Build your first android things application

  • 1. Build your first Android Things application Keval Patel Android Developer @ 1
  • 2. Agenda - Introduction to Raspberry Pi. - Specifications & Schematics of Raspberry Pi. - How to connect Raspberry Pi to your computer?- Create a new project for Android Things. - What’s different than normal app development? - Accessing hardware components in Android app. - Introduction: Smart Switch App 2
  • 4. What is Raspberry Pi? A computer. A small single-board computer that plugs into your TV and a keyboard, which can be used for many of the things that your average desktop does - spreadsheets, word-processing, games and it also plays high-definition video. 4
  • 5. What is Raspberry Pi? Small - Size of the credit card. Affordable - Just $35!!! Single Board SoC. Consumes less than 5W power. Developed by Raspberry Pi foundation. Board for the hobbyist. 5
  • 6. 6
  • 7. Which OS you can run? - Raspbian OS - Fedora OS - Debian OS - Windows 10 - And now Android... 7
  • 8. Raspberry Pi 3 Model B - Released in Feb 2016. - Costs $35. - Supports Android Things. 8
  • 9. Raspberry Pi 3 Model B Specification - Quad-core 64-bit ARM Cortex-A53, 1.2GHz - Broadcom VideoCore IV - 1GB LPDDR2 (900 MHz) - 10/100 Ethernet - 2.4GHz 802.11n wireless - Bluetooth 4.1 and Bluetooth Low Energy - 40-pin GPIO header - Ports: HDMI, 3.5mm analog audio-video jack, 4× USB 2.0, Ethernet, Camera Serial Interface (CSI), Display Serial Interface (DSI) 9
  • 10. 10
  • 11. GPIO - GPIO = General Purpose Input Output. - You can configure that pin to act as input or output pin at runtime. - No predefined purpose, and go unused by default. - Raspberry Pi has 40 GPIO pins. - The pins allow us to interact with different components and receive and send information to them. 11
  • 13. How to connect with Raspberry Pi? 13
  • 14. How to connect with Raspberry Pi? 1. Connect USB cable for power. 2. Connect an Ethernet cable your local network. 3. Connect an HDMI cable to an display. (Optional) 4. Find the IP of Raspberry Pi using IP scanner tool. (e.g. Angry IP scanner.) The host name will be “Android.local”. 5. Connect to this IP address using the adb. $ adb connect <ip-address> connected to <ip-address>:5555 14
  • 15. How to connect with Wi-Fi? 1. Send an intent to the Wi-Fi service with the SSID and passcode of your Wi-Fi network. You need to do it only when connecting to new Wi-Fi network. $ adb shell am startservice -n com.google.wifisetup/.WifiSetupService -a WifiSetupService.Connect -e ssid <Network_SSID> -e passphrase <Network_Passcode> $ adb connect <ip-address> connected to <ip-address>:5555 2. Find the IP of Raspberry Pi using IP scanner tool. 3. Connect to this IP address using the adb. 15
  • 16. How to check if the internet access available? rpi3:/ $ ping google.com PING google.com (216.58.199.142) 56(84) bytes of data. 16
  • 18. Build Android Things Project - Create new android project. 18
  • 19. Build Android Things Project - Set the minSdkVersion for the project to 24. 19
  • 20. Build Android Things Project - Add “com.google.android.things” library to “AndroidManifest.xml”. <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"> <uses-library android:name="com.google.android.things"/> <activity android:name=".MainActivity"> .... .... </activity> </application> 20
  • 21. Add Home activity support - "Home activity" in its manifest as the main entry point for the system to automatically launch on boot. <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <!-- Launch activity automatically on boot --> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.IOT_LAUNCHER"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> 21
  • 23. Android Things App Vs. Phone App - In Android Things UI is optional. - Android Things launcher does not have an app drawer. You need to launch the application using ADB. - There is no system-wide status bar and window shade in Android Things. So, notifications are not supported. - No system-wide navigation bar. So, back button, home button, and app switcher are supported. 23
  • 24. Android Things App Vs. Phone App - Android Things supports a subset of the Google APIs for Android. - Each release of Android Things bundles the latest stable version of Google Play Services, and requires at least version 10.0.0 of the client SDK. 24
  • 25. - No runtime permission. Just declare permission in AndroidManifest. (Just like old days!!!) - No support for the Google Play. Android Things App Vs. Phone App - Doesn't include the all of the standard system apps and content providers. Like SMS application and SMS provider. Avoid using them. 25
  • 26. How to access GPIO? 26
  • 27. Setting GPIO - Open GPIO pin using PeripheralManagerService. PeripheralManagerService service = new PeripheralManagerService(); mRedPin = service.openGpio(BoardDefaults.getGPIOForRedLED()); - Define pin as input or output. //Define as output mRedPin.setDirection(Gpio.DIRECTION_OUT_INITIALLY_LOW); //Or mRedPin.setDirection(Gpio.DIRECTION_OUT_INITIALLY_HIGH); //Set as input mRedPin.setDirection(Gpio.DIRECTION_IN); 27
  • 28. Peripheral Driver Library - There are many sensors we may need in our project. - All sensors have different specs and different types of input/output. - You don’t want to write code to integrate those sensors in your application. - Peripheral Driver Library contains pre-written user drivers for popular peripherals available for supported Android Things hardware. - It is open sourced. (https://github.com/androidthings/contrib-drivers) 28
  • 30. Smart Switch 30 Control the devices like fan, light bulb using your phone. - Can control 1 fan, 1 light bulb and 1 LED. - Uses firebase real-time database to sync the status of the home device between raspberry pi and companion app.
  • 31. Components required - Raspberry Pi 31 - 2 x 5V Relay - 1 LED - 1K resistor - Breadboard - Wires/Connectors
  • 32. 32
  • 35. What’s next??? 35 - Go ahead and download from GitHub (https://goo.gl/1CHzrB). Play with your own devices. - Try out different samples from Android Things samples (https://goo.gl/aTRWTN) page. - Make your own project.
  • 36. References 36 - Android Things - Android Developers (https://goo.gl/PefyPY) - Android Things - GitHub (https://goo.gl/AWA1Co) - Android Things – Hardware Basics for the Software Engineer (https://goo.gl/ini66V) - SmartSwitch - Github (https://goo.gl/1CHzrB)
  • 37. What you are going to build now? @kevalpatel2106 @multidots 37