Android Wear 进阶 2 Creating Wearable Apps-创建手表程序

Creating Wearable Apps创建手表应用

Get started

Dependencies and Prerequisites

  • An Android Wear device

Wearable apps run directly on the device, giving you access to hardware such as sensors and the GPU. They are fundamentally the same as apps built for other devices using the Android SDK, but differ greatly in design and usability and the amount of functionality provided. These are the main differences between handheld and wearable apps:手表应用直接运行在设备,让你可以访问到硬件,例如感应器和GPU。他们可以和使用Android SDK 在其他的设备上面创建的应用一样,但是在设计和使用的上面有很大的不同,并且提供了一堆功能。这里是手表端和手机端的主要的区别。

  • Wearable apps are relatively small in size and functionality compared to handheld apps. They contain only what makes sense on the wearable, which is usually a small subset of the corresponding handheld app. In general, you should carry out operations on the handheld when possible and send the results to the wearable.
  • 手表应用和手机应用相比在尺寸和功能上面相对较小。他们包含了仅仅是对手表有意义的,这些只是手机应用的一部分。通俗的来说,你应该在手机端处理了然后把结果返回给手表端。
  • Users don't download apps directly onto the wearable. Instead, you bundle the wearable app inside the handheld app. When users install the handheld app, the system automatically installs the wearable app. However, for development purposes, you can still install the wearable app directly to the wearable.
  • 用户不会直接将手表应用下载到手表上。相反的,你要将手表的应用绑定在手机的应用里面。当用户安装手机应用的时候,系统自动的安装手表应用。然而,为了开发的需要,你可以直接的在手表上面安装。
  • Wearable apps can access much of the standard Android APIs, but don't support the following APIs:

    • android.webkit
    • android.print
    • android.app.backup
    • android.appwidget
    • android.hardware.usb

    You can check if a wearable supports a feature by calling hasSystemFeature() before trying to use an API.

  • 手表应用可以访问很多的标准的额Android API,但是下面的api是不支持的

  • 你可以在你使用一个API之前,通过hasSystemFeature()来检查手表是否支持这个特性

To conserve power on a wearable device, you can enable ambient mode for your Wear app. Devices transition from interactive to ambient mode when the user is idle on an activity or when the user covers the screen with their palm. Wearable apps that can(SHOULD BE CAN NOT ?)transition into ambient mode are called always-on apps. The following describes the two modes of operation for always-on apps:

为了保存手表设备的电力,你在你的手表应用上面可以开启ambient(环境)模式。单用户不再使用一个activity 或者用户使用palm手掌盖住你的界面的时候设备将会从交互的模式切换到ambient(环境)模式。手表应用应用能转换到环境模式的话会被被称为一直开启的应用。下面描述一直开启的应用的两种模型

Interactive 交互
Use full color with fluid animation in this mode. The app is also responsive to input.
在这个模型里面使用全色彩流动画面。这个应用也可以相应输入。
Ambient 环境模式(这个模式不是黑屏的模式,而是最暗的那种模式)
Render the screen with grayscale graphics and do not present any input cues in this mode. This display mode is only supported on devices running Android 5.1 or higher.
在这个模式里面使用灰度的图来表达( Render )屏幕并且不展示任何的输入提示。这个模式只支持运行在Android 5.1或者更高的。

On devices running versions prior to Android 5.1 or for apps that do not support ambient mode, when a user is idle on an activity or when the user covers the screen with their palm on an activity, the Wear home screen is displayed instead of your activity in ambient mode. If you need to show persistent content on versions prior to Android 5.1, create a notification in the context stream instead.

在运行在Android 5.1之前的版本或者应用不支持ambient mode 环境模式的环境下,当一个用户不再使用一个activity 或者用户使用手掌盖住了屏幕的时候,手表的主界面会显示,而不是你的在环境模式下的activity。如果你需要在Android 5.1 之前的版本上面一致的内容,那么创建一个通知在上下文流中。

Note: We recommend using Android Studio for Android Wear development, as it provides project setup, library inclusion, and packaging conveniences. The rest of this training assumes you're using Android Studio.

注意:我们建议使用Android Studio

Lessons课程



Creating and Running a Wearable App 创建和运行一个手表应用
Learn how to create an Android Studio project that contains both the wearable and handheld app modules and how to run the app on a device or emulator.
学习如何创建一个Android Studio 项目,这个项目包含了手表和手机应用模型,还要学习如何在一个设备或者模拟器上面运行
Creating Custom Layouts 创建自定义布局
Learn how to create and display custom layouts for notifications and activities.
学习如何去创建和展示通知和activity的自定义布局
Keeping Your App Visible 保持你的应用可见
Learn how to enable ambient mode for your apps, so they remain visible while still saving battery power.
学习如何开启你的应用的ambient环境 模式,然后他们在节省电池电量的情况下保持可见。
Adding Voice Capabilities 添加声音能力
Learn how to launch an activity with voice actions and how to start the system speech recognizer app to obtain free-form voice input.
学习如何通过声音的action 来启动activity,学习如何去开始系统的
Packaging Wearable Apps 打包你的手表应用
Learn how to package a wearable app inside a handheld app. This allows the system to install the wearable app automatically when users install the companion handheld app from the Google Play store.
学习如何在手机应用打包手表应用。这个允许当用户安装同行的( companion )手机端,系统会去自动安装手表应用。
Debugging over Bluetooth 通过蓝牙调试
Learn how to debug your wearable over Bluetooth instead of USB.
学习如何使用蓝牙调试,而不是USB



你可能感兴趣的:(Android,Wear,Develope,Guider)