Android Things Environment Setup

In this tutorial you will learn about the Android Things Environment Setup and its application with practical example.

  1. Step : Create Android Things Account for Raspberry Pi :- First we need to create account with Android things for Raspberry Pi. Visit https://partner.android.com/things/ and go to console, Here you need to create your developer account from your Gmail account or Simply Sign In with Google ID.

Table Of Contents

After sign with Google Id you will find below screen

iot-1

Simply click on Create A Product.

  1. Step: Create New Product : When you will click on Create A Product You will get A popup screen in which you have to fill some details for creation of your product. The Screen will be like below Image.

iot-2

Enter Your Product Name , You can select SOM(System On Module) type , Here we used Raspberry Pi 3 so I select it and finally enter Product Description. Click on Create Button.

 

First time the screen will be shown like below image, From here you can Update your project details.

iot-3

# Just go to on Factory Images, You will get screen like below image

4

# Scroll down this Page you will find Android things version, like below Image

5

#Just Click on Create Build Configuration, You will get new Option in Factory Image tab, Like below Image.

6

# Just click on Download build. After Download you have to extract that file, when your extraction is completed you will get .img file(a.k.a OS image file) like below image.

7

Step: Need to Burn this image to SD card : Just Visit https://etcher.io/ website and download software. This is open source software by resin.io. After downloading open etcher. You will get screen like below image

8

#Select System Image(.img) file for burning it on your SD card, like below Image

9

#Select your SD Card for Burning OS on SD Card, After that click on Flash and wait till auto ejected by etcher.

10 11 13

 

So you have burned your OS on SD card now just follow 4th step.

4th Step: Raspberry Pi 3 Setup:

1 : After Burning process etcher will unplugged SD Card, Just remove from your Laptop or Desktop and insert into Raspberry Pi 3.

2 : Connect Raspberry Pi 3 to Ethernet.

3 : Power it up with 5V adapter.

4: Do wiring for LED like below image

 

iot-14

5th Step : Working With Android Studio: Now we have to do code on android for out first project. Before start coding you must have to upgrade your Android Studio version if it is not. I am working on
Android Studio 3.0. After Upgradation Just create new project.

Follow the steps like below Images.

//Image of creating project

iot-15

iot-16

iot-17

#After creating project now we need to add some dependencies open your build.gradle(Module: app)

iot-18

#Build Gradle code:

# Main Activity : Now We have to do code for MainActivity.java. Complete code of Main Activity is below

6th Step : Before running your program you must have to establish a connection between Android Studio and Android Things(Raspberry Pi 3) so that we can debug our program. The mediator will be IP Address. Open your router panel to obtain IP for Raspberry Pi. Now check your Local IP. Suppose it is 192.168.1.3.
Now How to connect: We have ADB (Android debug Bridge) tool. It will act as a bridge between or Android Things and Android Studio and it also help us to run our program on Raspberry Pi 3.

# Open command Prompt: Just connect adb with IP using below command on Command Prompt

iot-19

After successful connection just run your program. You will get your output on LED.

In this tutorial we have learn about the Android Things Environment Setup and its application with practical example. I hope you will like this tutorial.