Skip to content

Most visited

Recently visited

navigation

Create an Android Things Project

This lesson teaches you to

  1. Create a Things Project
  2. Create a Home Activity

You should also read

Things apps use the same structure as those designed for phones and tablets. This similarity means you can modify your existing apps to also run on embedded things or create new apps based on what you already know about building apps for Android.

This lesson describes how to prepare your development environment for Android Things, and the required changes to enable app to run on embedded things.

Prerequisites

Before you begin building apps for Things, you must:

Get started

To get started quickly, create your app project using the new project wizard:

The new project wizard automatically adds two necessary items to your Android Studio project: a dependency to the Android Things support library and a default launch activity.

Added library

Android Things devices expose APIs through support libraries that are not part of the Android SDK. The new project wizard automatically adds a dependency to the support library to your app-level build.gradle file:

    dependencies {
        ...
        compileOnly 'com.google.android.things:androidthings:+'
    }

The wizard adds <uses-library> to your app's manifest file to make this prebuilt library available to the app's classpath at run time.

Added home activity

An application intending to run on an embedded device must declare an activity in its manifest as the main entry point after the device boots. Note that the wizard applies an intent filter containing the following attributes:

For ease of development, this same activity includes a CATEGORY_LAUNCHER intent filter so Android Studio can launch it as the default activity when deploying or debugging.

<application>
    <uses-library android:name="com.google.android.things"/>
    <activity android:name=".HomeActivity">
        <!-- Launch activity as default from Android Studio -->
        <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>
</application>
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)