Merge "cherrypick from klp-modular-docs docs: make fixes to Wear training material Change-Id: I27c2c754a027f7202a6388a60008ad3a594132c4" into lmp-docs
This commit is contained in:
@ -19,7 +19,7 @@ page.title=Debugging over Bluetooth
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>You can debug your wearable over Bluetooth by routing it's debug output to the
|
<p>You can debug your wearable over Bluetooth by routing its debug output to the
|
||||||
handheld device that's connected to your development machine.</p>
|
handheld device that's connected to your development machine.</p>
|
||||||
|
|
||||||
<h2 id="SetupDevices">Setup Devices for Debugging</h2>
|
<h2 id="SetupDevices">Setup Devices for Debugging</h2>
|
||||||
|
@ -92,6 +92,11 @@ types of screen shapes, which is useful for testing.</p>
|
|||||||
<li>Leave the Android Wear app open on your phone.</li>
|
<li>Leave the Android Wear app open on your phone.</li>
|
||||||
<li>Connect the wearable to your machine through USB, so you can install apps directly to it
|
<li>Connect the wearable to your machine through USB, so you can install apps directly to it
|
||||||
as you develop. A message appears on both the wearable and the Android Wear app prompting you to allow debugging.</li>
|
as you develop. A message appears on both the wearable and the Android Wear app prompting you to allow debugging.</li>
|
||||||
|
<p class="note"><strong>Note:</strong> If you can not connect your wearable to your machine via USB,
|
||||||
|
follow the directions on
|
||||||
|
<a href="{@docRoot}training/wearables/apps/bt-debugging.html">Debugging over
|
||||||
|
Bluetooth</a>.
|
||||||
|
</p>
|
||||||
<li>On the Android Wear app, check <strong>Always allow from this computer</strong> and tap
|
<li>On the Android Wear app, check <strong>Always allow from this computer</strong> and tap
|
||||||
<strong>OK</strong>.</li>
|
<strong>OK</strong>.</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
@ -64,7 +64,7 @@ in ADT. The rest of this training assumes you're using Android Studio.
|
|||||||
<dd>Learn how to create and display custom layouts for notifications and
|
<dd>Learn how to create and display custom layouts for notifications and
|
||||||
activities.</dd>
|
activities.</dd>
|
||||||
<dt><a href="{@docRoot}training/wearables/apps/voice.html">Adding Voice Capabilities</a></dt>
|
<dt><a href="{@docRoot}training/wearables/apps/voice.html">Adding Voice Capabilities</a></dt>
|
||||||
<dd>Learn how to launch an activity with a voice actions and how to start the
|
<dd>Learn how to launch an activity with voice actions and how to start the
|
||||||
system speech recognizer app to obtain free-form voice input.</dd>
|
system speech recognizer app to obtain free-form voice input.</dd>
|
||||||
<dt><a href="{@docRoot}training/wearables/apps/packaging.html">Packaging Wearable Apps</a></dt>
|
<dt><a href="{@docRoot}training/wearables/apps/packaging.html">Packaging Wearable Apps</a></dt>
|
||||||
<dd>Learn how to package a wearable app inside a
|
<dd>Learn how to package a wearable app inside a
|
||||||
|
@ -12,9 +12,9 @@ page.title=Accessing the Wearable Data Layer
|
|||||||
|
|
||||||
<h2>Dependencies and Prerequisites</h2>
|
<h2>Dependencies and Prerequisites</h2>
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href="{@docRoot}training/wearables/apps/environment.html">Creating
|
<li><a href="{@docRoot}training/wearables/apps/creating.html#SetupEmulator">Creating
|
||||||
Wearable Apps > Setting up Your Environment</a></li>
|
Wearable Apps > Set Up an Android Wear Emulator or Device</a></li>
|
||||||
<li><a href="{@docRoot}training/wearables/apps/creating.html">Creating
|
<li><a href="{@docRoot}training/wearables/apps/creating.html#CreateProject">Creating
|
||||||
Wearable Apps > Creating a Project</a></li>
|
Wearable Apps > Creating a Project</a></li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,14 +47,14 @@ directly. Instead, you:
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
However, instead of working with raw bytes using <a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataRequest.html#setData(byte[])">setData()</a>,
|
However, instead of working with raw bytes using <a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataRequest.html#setData(byte[])">setData()</a>,
|
||||||
we recommend you <a href="#data-map">use a data map</a>, which exposes
|
we recommend you <a href="#SyncData">use a data map</a>, which exposes
|
||||||
a data item in an easy-to-use {@link android.os.Bundle}-like interface.
|
a data item in an easy-to-use {@link android.os.Bundle}-like interface.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 id="SyncData">Sync Data with a Data Map</h2>
|
<h2 id="SyncData">Sync Data with a Data Map</h2>
|
||||||
<p>
|
<p>
|
||||||
When possible, use the <a href="{@docRoot}reference/com/google/android/gms/wearable/DataMap.html"><code>DataMap</code></a> class,
|
When possible, use the <a href="{@docRoot}reference/com/google/android/gms/wearable/DataMap.html"><code>DataMap</code></a> class.
|
||||||
which lets you work with data items in the form of an Android {@link android.os.Bundle},
|
This approach lets you work with data items in the form of an Android {@link android.os.Bundle},
|
||||||
so object serialization and de-serialization is done for you, and you can manipulate data with key-value pairs.
|
so object serialization and de-serialization is done for you, and you can manipulate data with key-value pairs.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -120,5 +120,5 @@ public void onDataChanged(DataEventBuffer dataEvents) {
|
|||||||
<p>
|
<p>
|
||||||
This is just a snippet that requires more implementation details. Learn about
|
This is just a snippet that requires more implementation details. Learn about
|
||||||
how to implement a full listener service or activity in
|
how to implement a full listener service or activity in
|
||||||
<a href="{@docRoot}training/wearables/data-layer/events.html">Listening for Data Layer Events</a>.
|
<a href="{@docRoot}training/wearables/data-layer/events.html#Listen">Listening for Data Layer Events</a>.
|
||||||
</p>
|
</p>
|
@ -159,7 +159,7 @@ public class DataLayerListenerService extends WearableListenerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loop through the events and send a message
|
// Loop through the events and send a message
|
||||||
/ to the node that created the data item.
|
// to the node that created the data item.
|
||||||
for (DataEvent event : events) {
|
for (DataEvent event : events) {
|
||||||
Uri uri = event.getDataItem().getUri();
|
Uri uri = event.getDataItem().getUri();
|
||||||
|
|
||||||
|
@ -83,5 +83,3 @@ channel.
|
|||||||
<dt><a href="{@docRoot}training/wearables/data-layer/events.html">Handling Data Layer Events</a></dt>
|
<dt><a href="{@docRoot}training/wearables/data-layer/events.html">Handling Data Layer Events</a></dt>
|
||||||
<dd>Be notified of changes and events to the data layer.</dd>
|
<dd>Be notified of changes and events to the data layer.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</div>
|
|
@ -27,7 +27,7 @@ Messages are a one-way communication mechanism that's good for remote procedure
|
|||||||
such as sending a message to the wearable
|
such as sending a message to the wearable
|
||||||
to start an activity. You can also use messages in request/response model
|
to start an activity. You can also use messages in request/response model
|
||||||
where one side of the connection sends a message, does some work,
|
where one side of the connection sends a message, does some work,
|
||||||
sends back a response message.</p>
|
and sends back a response message.</p>
|
||||||
|
|
||||||
<h2 id="SendMessage">Send a Message</h2>
|
<h2 id="SendMessage">Send a Message</h2>
|
||||||
|
|
||||||
@ -95,5 +95,5 @@ public void onMessageReceived(MessageEvent messageEvent) {
|
|||||||
<p>
|
<p>
|
||||||
This is just a snippet that requires more implementation details. Learn about
|
This is just a snippet that requires more implementation details. Learn about
|
||||||
how to implement a full listener service or activity in
|
how to implement a full listener service or activity in
|
||||||
<a href="{@docRoot}training/wearables/data-layer/events.html">Listening for Data Layer Events</a>.
|
<a href="{@docRoot}training/wearables/data-layer/events.html#Listen">Listening for Data Layer Events</a>.
|
||||||
</p>
|
</p>
|
@ -4,7 +4,6 @@ page.title=Creating a Notification
|
|||||||
|
|
||||||
<div id="tb-wrapper">
|
<div id="tb-wrapper">
|
||||||
<div id="tb">
|
<div id="tb">
|
||||||
|
|
||||||
<h2>This lesson teaches you to</h2>
|
<h2>This lesson teaches you to</h2>
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href="#Import">Import the Necessary Classes</a></li>
|
<li><a href="#Import">Import the Necessary Classes</a></li>
|
||||||
@ -30,7 +29,6 @@ Notifications using {@link android.widget.RemoteViews} are stripped of custom
|
|||||||
layouts and the wearable only displays the text and icons. However, you can create
|
layouts and the wearable only displays the text and icons. However, you can create
|
||||||
<a href="{@docRoot}training/wearables/apps/layouts.html#CustomNotifications">create custom notifications</a>
|
<a href="{@docRoot}training/wearables/apps/layouts.html#CustomNotifications">create custom notifications</a>
|
||||||
that use custom card layouts by creating a wearable app that runs on the wearable device.</p>
|
that use custom card layouts by creating a wearable app that runs on the wearable device.</p>
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2 id="Import">Import the necessary classes</h2>
|
<h2 id="Import">Import the necessary classes</h2>
|
||||||
|
|
||||||
@ -255,7 +253,7 @@ NotificationCompat.WearableExtender wearableExtender =
|
|||||||
Notification notif = new NotificationCompat.Builder(mContext)
|
Notification notif = new NotificationCompat.Builder(mContext)
|
||||||
.setContentTitle("New mail from " + sender)
|
.setContentTitle("New mail from " + sender)
|
||||||
.setContentText(subject)
|
.setContentText(subject)
|
||||||
.setSmallIcon(R.drawable.new_mail);
|
.setSmallIcon(R.drawable.new_mail)
|
||||||
.extend(wearableExtender)
|
.extend(wearableExtender)
|
||||||
.build();
|
.build();
|
||||||
</pre>
|
</pre>
|
||||||
@ -278,7 +276,7 @@ method, in the <code>res/drawable-hdpi</code> directory of your handheld app.</p
|
|||||||
<p>If you ever need to read wearable-specific options at a later time, use the corresponding get
|
<p>If you ever need to read wearable-specific options at a later time, use the corresponding get
|
||||||
method for the option. This example calls the
|
method for the option. This example calls the
|
||||||
{@link android.support.v4.app.NotificationCompat.WearableExtender#getHintHideIcon()} method to
|
{@link android.support.v4.app.NotificationCompat.WearableExtender#getHintHideIcon()} method to
|
||||||
get whether or not this notification hides the icon:
|
get whether or not this notification hides the icon:</p>
|
||||||
<pre>
|
<pre>
|
||||||
NotificationCompat.WearableExtender wearableExtender =
|
NotificationCompat.WearableExtender wearableExtender =
|
||||||
new NotificationCompat.WearableExtender(notif);
|
new NotificationCompat.WearableExtender(notif);
|
||||||
@ -304,14 +302,3 @@ notificationManager.notify(notificationId, notif);
|
|||||||
features from {@link android.support.v4.app.NotificationCompat.WearableExtender}
|
features from {@link android.support.v4.app.NotificationCompat.WearableExtender}
|
||||||
do not work, so make sure to use {@link android.support.v4.app.NotificationCompat}.
|
do not work, so make sure to use {@link android.support.v4.app.NotificationCompat}.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
|
||||||
NotificationCompat.WearableExtender wearableExtender =
|
|
||||||
new NotificationCompat.WearableExtender(notif);
|
|
||||||
boolean hintHideIcon = wearableExtender.getHintHideIcon();
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<p>The {@link android.support.v4.app.NotificationCompat.WearableExtender} APIs allow you to add
|
|
||||||
additional pages to notifications, stack notifications, and more. Continue to the following lessons
|
|
||||||
to learn about these features.
|
|
||||||
</p>
|
|
||||||
|
@ -49,5 +49,3 @@ swipes to the left.</dd>
|
|||||||
<dd>Learn how to place all similar notifications from your app in a stack, allowing users to view
|
<dd>Learn how to place all similar notifications from your app in a stack, allowing users to view
|
||||||
each notification individually without adding multiple cards to the card stream.</dd>
|
each notification individually without adding multiple cards to the card stream.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</div>
|
|
@ -87,7 +87,7 @@ notification and call {@link android.support.v4.app.NotificationCompat.Builder#s
|
|||||||
on the summary notification.</p>
|
on the summary notification.</p>
|
||||||
|
|
||||||
<p>This notification does not appear in your stack of notifications on the wearable, but
|
<p>This notification does not appear in your stack of notifications on the wearable, but
|
||||||
appears as the only notification on the handheld device.</p>
|
it appears as the only notification on the handheld device.</p>
|
||||||
|
|
||||||
<pre style="clear:right">
|
<pre style="clear:right">
|
||||||
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(),
|
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(),
|
||||||
|
@ -86,7 +86,7 @@ style="float:right;margin:0 0 20px 40px" />
|
|||||||
{@link android.support.v4.app.RemoteInput}:</p>
|
{@link android.support.v4.app.RemoteInput}:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
public static final EXTRA_VOICE_REPLY = "extra_voice_reply";
|
public static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
|
||||||
...
|
...
|
||||||
String replyLabel = getResources().getString(R.string.reply_label);
|
String replyLabel = getResources().getString(R.string.reply_label);
|
||||||
String[] replyChoices = getResources().getStringArray(R.array.reply_choices);
|
String[] replyChoices = getResources().getStringArray(R.array.reply_choices);
|
||||||
@ -116,7 +116,7 @@ PendingIntent replyPendingIntent =
|
|||||||
// Create the reply action and add the remote input
|
// Create the reply action and add the remote input
|
||||||
NotificationCompat.Action action =
|
NotificationCompat.Action action =
|
||||||
new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon,
|
new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon,
|
||||||
getString(R.string.label, replyPendingIntent))
|
getString(R.string.label), replyPendingIntent)
|
||||||
.addRemoteInput(remoteInput)
|
.addRemoteInput(remoteInput)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user