Android Things 开发

Android Things简介
Android Things 开发
开发板刷Android Things系统


Building Your First Device

Create an Android Things Project
创建一个Android Things 应用程序

1,Prerequisites:开发的前提条件

Before you begin building apps for Things, you must:

1,Update your SDK tools to version 24 or higher The updated SDK tools enable you to build and test apps for Things.
2,Update your SDK with Android 7.0 (API 24) or higher The updated platform version provides new APIs for Things apps.
3,Create or update your app project In order to access new APIs for Things, you must create a project or modify an existing project that targets Android 7.0 (API level 24) or higher

1,更新sdk中build-tools的版本(24或者更高),更新后的sdk可以让你构建和测试你的Things应用程序。
2,更新sdk中Android系统版本为Android 7.0(24)或者更高,它提供了开发Android Things应用程序新的API。
3,当你创建或者修改现有项目的时候,项目的API要是24或者更高,这样你才能访问Things的API。

2,Add the library
androidthings不是Android sdk中的一部分,它是以支持库的方式存在,所以你要对其进行配置。
1,Add the dependency artifact to your app-level build.gradle file:

dependencies {
    ...
    provided 'com.google.android.things:androidthings:0.1-devpreview'
}

2,Add the things shared library entry to your app’s manifest file:

<application ...>
    <uses-library android:name="com.google.android.things"/>
    ...
</application>

uses-library :把程序包类装载器中需要包含的库代码通知系统

3,Declare a home activity
配置Activity

Action: ACTION_MAIN
Category: CATEGORY_DEFAULT
Category: IOT_LAUNCHER
<application
    android:label="@string/app_name">
    <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>

至此怎么创建一个Android Things应用程序开发完毕。

测试:写一个activity,随便打印log,按照以上配置,然后运行程序,看Console控制台输出。


在往下就是需要连接外设及和外设进行交互。

Connect the Hardware

Interact with Peripherals

Integrate Peripheral Drivers

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值