DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Big Data
  4. Android Things: An Android IoT Tutorial

Android Things: An Android IoT Tutorial

Android Things is easy to start using. Learn how to get everything all set up so you can start using Android with your IoT projects!

Francesco Azzola user avatar by
Francesco Azzola
CORE ·
Jan. 04, 17 · Tutorial
Like (4)
Save
Tweet
Share
10.61K Views

Join the DZone community and get the full member experience.

Join For Free
android things is the new os announced by google. this is an android-based os for the internet of things (iot). if you are new to iot, take a look at my article explaining iot .  as the name android things implies, it is a modified version of android os that runs on our smartphones. this os joins the android family with android, android tv, and android auto.

what is android things?

android things is the new os developed by google for iot. if we look at the past, google made another attempt to jump into iot ecosystem with brillo that was not largely successful. even if android things is still in the developer preview version,  it introduces some important features that make it different from brillo. android things supports only three iot devices :

  • intel edison
  • nxp pico
  • raspberry pi 3

the list, by now, is quite limited but the os is still in the preview version so more devices will be added in the future.

android things is a modified version of android and it has a subset of the android api. this aspect is very important because android developers can move to android things smoothly. they use the android development experience.  of course, the apis related to maps authentication are not supported.

the overall development process used for android apps is still valid for android things, even the ide is the same. all these aspects will have a great positive impact on this os future. it is the first os that uses java as development language (as android), while others os or iot boards are based on c/c++. moreover, developers can reuse google cloud platform components like firebase in the development process.

further reading: getting started with android thigs, the new iot os.

how to install android things

now we know what is android internet of things known as android things we can start installing it. in this article, we will use raspberry pi 3 as a development board. what do we need?

this is the list of things we need to get started with android things os:

  • raspberry pi 3
  • micro sd card 8 gb or more
  • windows or os x

image title

at the beginning, it is necessary to format the sd card using fat 32. if you are using a mac, go to disk utility and format the card:

image title

all done. you are ready to install the developer preview image . download the image for raspberry. once the download is ready, we can install it:

sudo dd bs=1m if=path_of_your_image.img of=/dev/rdiskn

one important step is to identify the disk number (n) . you can do it using os x information and looking for the card reader device:

android things disk

the bsd number is the number we are looking for. in this case, n=1. during the installation process, you don’t have messages and you have simply to wait until the process is complete. at the end, you get a message saying that the disk is unreadable, it is ok, it works!

it is time to insert the new os disk into your raspberry pi.

verify android things installation

finally, we can verify if the installation is correct powering on the raspberry pi. you can use a usb cable connected to your pc to start raspberry. at the beginning, you need to connect raspberry to the lan using a cable and you need an hdmi cable to connect the board to a tv or monitor. if you don’t want to use an hdmi cable you can use vysor a chrome plugin.

when the boot process finishes, the result is shown below:

image title

if you get this screenshot it means that android internet of things is running on the raspberry pi 3.

now, it is possible to connect to the android things using adb as we do in android. moreover, it is possible to get the device list using adb devices:

image title

that’s all. android things is up and running. now, you can start developing your first iot project as we will see in the next article.

new api in android internet of things

even if android things is a subset of android, this new os introduces some important apis that are specific to the iot domain. when we create an iot project , we have to communicate with external sensors or actuators.  thus, android things uses two industry standards in peripheral i/o :

  • gpio for sensors
  • pwm for dc motors, lights, etc.

moreover, some content providers (calendar, telephony, etc.) are not supported.

an interesting aspect is that android things supports ui interface like a “normal” android app.

conclusion

after a few days, i can say that android things is an interesting iot os based on android. this is very important because the development process is the same used for an android app.  developers can reuse the android knowledge and experience. in this way, the transition is smooth. of course, android things is still a developer preview so many things could change but the beginning is very promising.

IoT Android Things Android (robot)

Published at DZone with permission of Francesco Azzola, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Using JSON Web Encryption (JWE)
  • Remote Debugging Dangers and Pitfalls
  • Kotlin Is More Fun Than Java And This Is a Big Deal
  • Why Open Source Is Much More Than Just a Free Tier

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: