1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
|
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<title>Get Started with the Developer Preview | Android Developers</title>
<!-- STYLESHEETS -->
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="/assets/css/default.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script src="//www.google.com/jsapi" type="text/javascript"></script>
<script src="/assets/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
var toRoot = "/";
var metaTags = [];
var devsite = false;
</script>
<script src="/assets/js/docs.js" type="text/javascript"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5831155-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="gc-documentation
" itemscope itemtype="http://schema.org/Article">
<a name="top"></a>
<!-- Header -->
<div id="header">
<div class="wrap" id="header-wrap">
<div class="col-3 logo-wear">
<a href="/wear/index.html">
<img src="/wear/images/android-wear.png" height="16" alt="Android Wear" />
</a>
</div>
<div class="col-8" style="margin:0"><h1 style="margin:1px 0 0 20px;padding:0;line-height:16px;
color:#666;font-weight:100;font-size:24px;">Developer Preview</h1></div>
<!-- New Search -->
<div class="menu-container">
<div class="moremenu">
<div id="more-btn"></div>
</div>
<div class="morehover" id="moremenu">
<div class="top"></div>
<div class="mid">
<div class="header">Links</div>
<ul>
<li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
<li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
<li><a href="/about/index.html">About Android</a></li>
</ul>
<div class="header">Android Sites</div>
<ul>
<li><a href="http://www.android.com">Android.com</a></li>
<li class="active"><a>Android Developers</a></li>
<li><a href="http://source.android.com">Android Open Source Project</a></li>
</ul>
<div class="header">Language</div>
<div id="language" class="locales">
<select name="language" onChange="changeLangPref(this.value, true)">
<option value="en">English</option>
<option value="es">Español</option>
<option value="ja">日本語</option>
<option value="ko">한국어</option>
<option value="ru">Русский</option>
<option value="zh-cn">中文 (中国)</option>
<option value="zh-tw">中文 (台灣)</option>
</select>
</div>
<script type="text/javascript">
<!--
loadLangPref();
//-->
</script>
<br class="clearfix" />
</div><!-- end mid -->
<div class="bottom"></div>
</div><!-- end morehover -->
<div class="search" id="search-container">
<div class="search-inner">
<div id="search-btn"></div>
<div class="left"></div>
<form onsubmit="return submit_search()">
<input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '/')"
onkeyup="return search_changed(event, false, '/')" />
</form>
<div class="right"></div>
<a class="close hide">close</a>
<div class="left"></div>
<div class="right"></div>
</div>
</div><!-- end search -->
<div class="search_filtered_wrapper reference">
<div class="suggest-card reference no-display">
<ul class="search_filtered">
</ul>
</div>
</div>
<div class="search_filtered_wrapper docs">
<div class="suggest-card dummy no-display"> </div>
<div class="suggest-card develop no-display">
<ul class="search_filtered">
</ul>
<div class="child-card guides no-display">
</div>
<div class="child-card training no-display">
</div>
<div class="child-card samples no-display">
</div>
</div>
<div class="suggest-card design no-display">
<ul class="search_filtered">
</ul>
</div>
<div class="suggest-card distribute no-display">
<ul class="search_filtered">
</ul>
</div>
</div><!-- end search_filtered_wrapper -->
</div>
<!-- end menu_container -->
</div><!-- end header-wrap -->
</div>
<!-- /Header -->
<div id="searchResults" class="wrap" style="display:none;">
<h2 id="searchTitle">Results</h2>
<div id="leftSearchControl" class="search-control">Loading...</div>
</div>
<div class="wrap clearfix" id="body-content">
<div class="col-4" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
<div id="devdoc-nav" class="scroll-pane">
<a class="totop" href="#top" data-g-event="left-nav-top">to top</a>
<ul id="nav">
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/preview/start.html">Get Started
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/user-interface.html">UI Overview
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/design/index.html">Design Principles
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/creating.html">Creating Notifications for Android Wear
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/remote-input.html">Receiving Voice Input from a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/pages.html">Adding Pages to a Notification
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/notifications/stacks.html">Stacking Notifications
</a></div>
</li>
<li class="nav-section">
<div class="nav-section-header"><a href="/reference/android/preview/support/package-summary.html">Notification Reference</a></div>
<ul class="tree-list-children">
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.v4.app">android.preview.support.v4.app</span></div>
<ul>
<li><a href="/reference/android/preview/support/v4/app/NotificationManagerCompat.html">NotificationManagerCompat</a></li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header-ref"><span class="tree-list-subtitle package" title="android.preview.support.wearable.notifications">android.preview.support.wearable.notifications</span></div>
<ul>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html">RemoteInput</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html" >RemoteInput.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.html">WearableNotifications</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.html">WearableNotifications.Action</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Action.Builder.html">WearableNotifications.Action.Builder</a></li>
<li><a href="/reference/android/preview/support/wearable/notifications/WearableNotifications.Builder.html">WearableNotifications.Builder</a></li>
</ul>
</li>
</ul>
</li>
<li class="nav-section">
<div class="nav-section-header empty"><a href="/wear/license.html">License Agreement</a></div>
</li>
</ul>
</div>
</div> <!-- end side-nav -->
<script>
$(document).ready(function() {
scrollIntoView("devdoc-nav");
});
</script>
<div class="col-12" id="doc-col" >
<h1 itemprop="name" >Get Started with the Developer Preview</h1>
<div id="jd-content">
<div class="jd-descr" itemprop="articleBody">
<div class="cols">
<div class="col-5">
<p>The Android Wear Developer Preview includes tools and APIs that allow you to
enhance your app notifications
to provide an optimized user experience on Android wearables.</p>
<p>With the Android Wear Developer Preview, you can:</p>
<ul>
<li>Run the Android Wear platform in the Android emulator.</li>
<li>Connect your Android device to the emulator and view notifications from the
device as cards on Android Wear.</li>
<li>Try new APIs in the preview support library that enhance your app's notifications
with features such as voice replies and notification pages.</li>
</ul>
<p>To get access to the Developer Preview tools,
click the sign up button on the right, then follow the setup instructions below.</p>
</div>
<div class="col-7">
<img src="/wear/images/laptop-bridge.png" width="400" height="222" alt="" />
<a href="/wear/preview/signup.html" class="button" style="
width: 370px;
margin: 10px 0 20px;
font-weight: bold;
font-size: 16px;
">Sign Up for the Developer Preview</a>
<p>Signing up provides you access to:</p>
<ul>
<li>New notification APIs in the preview support library.</li>
<li>Sample apps using the new notification APIs.</li>
<li>The <em>Android Wear Preview</em> app for your mobile device, which connects
your device to the Android Wear emulator.</li>
</ul>
</div>
</div>
<p class="caution"><strong>Caution:</strong>
The current Android Wear Developer Preview is intended for <b>development and testing purposes only</b>, not for production apps. Google may change this Developer Preview significantly prior to the official release of the Android Wear SDK. You may not publicly distribute or ship any application using this Developer Preview, as this Developer Preview will no longer be supported after the official SDK is released (which will cause applications based only on the Developer Preview to break).</p>
<h2 id="Prereq">Prerequisites</h2>
<p>Before you begin the setup, you must:</p>
<ol>
<li><a href="/sdk/index.html"><b>Install the Android SDK</b></a>.
<p>The Android SDK includes all the developer tools required to build
apps for Android (optional IDEs are also available for download).</p></li>
<li><a href="/wear/preview/signup.html"><b>Sign up for the Android Wear Developer Preview</b></a>.
<p>You must sign up with a Gmail or other Google account in order to download the
preview support library and receive access to the
<em>Android Wear Preview</em> beta app on Google Play Store.</p></li>
</ol>
<p class="note"><strong>Note:</strong>
If you're using the ADT plugin for Eclipse, you must update to version 22.6.1 or higher.
If you're using Android Studio, you must update to version 0.5.1 or higher</p>
<h2 id="Install">1. Install the Android Wear System Image</h2>
<ol>
<li>Launch <a href="/tools/help/sdk-manager.html"
>Android SDK Manager</a>.
<ul>
<li>From Eclipse, select <b>Window > Android SDK Manager</b>.</li>
<li>From Android Studio, select <b>Tools > Android > SDK Manager</b>.</li>
</ul>
</li>
<li>Below Tools, verify that you have Android SDK Tools revision 22.6 or higher.
<p>If your version of Android SDK Tools is lower than 22.6, you must update:</p>
<ol>
<li>Select <strong>Android SDK Tools</strong>.</li>
<li>Click <strong>Install package</strong>.</li>
<li>Accept the license and click <strong>Install</strong>.</li>
<li>When the installation completes, restart Android SDK Manager.</li>
</ol>
</li>
<li>Below Android 4.4.2, select <strong>Android Wear ARM EABI v7a System Image</strong>.
<p class="note"><strong>Note:</strong> Android Wear is designed to support multiple processor architectures.
</p></li>
<li>Below Extras, ensure that you have the latest version of the
<a href="/tools/support-library/index.html">Android Support Library</a>.
If an update is available, select <strong>Android Support Library</strong>. If you're using Android Studio, also select <strong>Android Support Repository</strong>.</li>
<li>Click <strong>Install packages</strong>.</li>
<li>Accept the license and click <strong>Install</strong>.</li>
</ol>
<h2 id="SetupEmulator">2. Set Up the Android Wear Emulator</h2>
<ol>
<li>Launch the <a href="/tools/help/avd-manager.html"
>Android Virtual Device Manager</a>.
<ul>
<li>From Eclipse, select <b>Window > Android Virtual Device Manager</b>.</li>
<li>From Android Studio, select <b>Tools > Android > AVD Manager</b>.</li>
</ul>
</li>
<li>Click <strong>New</strong>.</li>
<li>For the AVD Name, enter "AndroidWearSquare" or "AndroidWearRound", depending on whether
you want to create an emulator with a square or round display.</li>
<li>For the Device, select <strong>Android Wear Square</strong> or
<strong>Android Wear Round</strong>.</li>
<li>For the Target, select <strong>Android 4.4.2 - API Level 19</strong> (or higher).</li>
<li>For the CPU/ABI, select <strong>Android Wear ARM (armeabi-v7a)</strong>.
<p class="note"><strong>Note:</strong> Android Wear is designed to support multiple processor architectures.
</p></li>
<li>For the Skin, select <strong>AndroidWearSquare</strong> or
<strong>AndroidWearRound</strong>.</li>
<li>Leave all other options set to their defaults and click <strong>OK</strong>.
<p>Although real Android wearables do not provide a keyboard as an input method,
you should keep <strong>Hardware keyboard present</strong> selected so you can
provide text input on screens where users will instead provide voice input.</p>
</li>
<!--
<li>Click <strong>Device Definitions</strong>.</li>
<li>Select <strong>Android WearSquare</strong> then click <strong>Create AVD</strong>.</li>
<li>Click <strong>OK</strong>.</li>
-->
<li>In the list of AVDs, select the one you just created and click
<strong>Start</strong>. In the following window, click <strong>Launch</strong>.</li>
</ol>
<p>The Android Wear emulator now starts. To begin testing your app's notifications,
you must now pair the emulator to your development device
that has the <em>Android Wear Preview</em> app installed.</p>
<p class="note"><strong>Tip:</strong> To improve the emulator startup time, edit your AVD
and enable <strong>Snapshot</strong> under Emulator Options. When you start the emulator,
select <strong>Save to snapshot</strong> then click <strong>Launch</strong>. Once the emulator
is running, close it to save a snapshot of the system.
Start the AVD again, but select <strong>Launch from snapshot</strong> and
deselect <strong>Save to snapshot</strong>.</p>
<p class="caution"><strong>Caution:</strong> Do not install apps on the Android Wear emulator.
The system does not support traditional Android apps and the result of running such apps is
unpredictable.</p>
<h2 id="SetupApp">3. Set Up the Android Wear Preview App</h2>
<p>To view your app's notifications on the Android Wear emulator, you must have the
<em>Android Wear Preview</em> app installed on your Android device (a phone or tablet).</p>
<p>To receive the Android Wear Preview app, you must <a
href="/wear/preview/signup.html">sign up for the Developer Preview</a> using the same
Gmail or Google account you use with Google Play Store.</p>
</p>
<p class="note"><strong>Note:</strong> The <em>Android Wear Preview</em> app is compatible with
Android 4.3 and higher and is not available for the Android emulator.</p>
<p>After you've signed up for the Developer Preview,
you'll receive a confirmation email that includes a link to opt-in to the
<em>Android Wear Preview</em> app beta program. Once you opt-in, it may take up to 24 hours for the
app to become available in Google Play Store.</p>
<p>After you install the <em>Android Wear Preview</em> app, you can set up
your device to communicate with the Android Wear emulator:</p>
<ol>
<li>Open the <em>Android Wear Preview</em> app. You should see a notice that the app is currently
not enabled as a notification listener. Tap the message to open the system settings,
then select Android Wear Preview to grant it notification access.</li>
<li>Connect your device to your development machine over USB. Be sure that no other
Android devices are connected to the machine.</li>
<li>Ensure that the Android Wear emulator (created in the previous section) is running.
The emulator should show the time and an icon that indicates no device is connected.</li>
<li>Open a command line terminal, navigate to your Android SDK's <code>platform-tools/</code>
directory, then execute:
<pre style="margin-top:.5em">adb -d forward tcp:5601 tcp:5601</pre></li>
<li>Return to the Android Wear Preview app. It should now indicate that it is connected to
the emulator. The Android Wear emulator should now show the 'g' orb icon, indicating
that is is connected to your device.
</ol>
<p>Now, notifications from your device also appear in the Android Wear emulator.</p>
<h2 id="AddLibrary">4. Add the Support Library to Your Project</h2>
<p>The Android Wear preview support library includes several APIs that allow you to
optimize your app's notifications for the Android Wear user experience.</p>
<p>To receive the preview support library, you must <a
href="/wear/preview/signup.html">sign up for the Developer Preview</a>. The
confirmation email you receive after you sign up includes a link to download a ZIP file,
which contains the preview support library and some sample apps.</p>
<p>After you download and unzip the package, add the preview support library
sto your Android project:</p>
<p><b>If you're using Eclipse:</b></p>
<ol>
<li>In your Android app project, create a <code>libs/</code> directory in your project root
(the same location as the <code>AndroidManifest.xml</code> file).</li>
<li>Copy the v4 support library JAR file from your Android SDK directory (e.g.,
<code><sdk>/extras/android/support/v4/android-support-v4.jar</code>) into your
project <code>libs/</code> directory.
<li>Also save the <code>wearable-preview-support.jar</code> file in the <code>libs/</code> directory.
<li>Right click each JAR file and select <strong>Build Path > Add to Build Path</strong>.</li>
</ol>
<p><b>If you're using Android Studio:</b></p>
<ol>
<li>In your Android app project, create a <code>libs/</code> directory in your project root
(the same location as the <code>AndroidManifest.xml</code> file).</li>
<li>Save the <code>wearable-preview-support.jar</code> file in the <code>libs/</code> directory.
<li>Open the <code>build.gradle</code> file in your app module.</li>
<li>Add a dependency rule for both the v4 support library and the Android Wear
preview support library:
<pre>
dependencies {
compile "com.android.support:support-v4:18.0.+"
compile files('../libs/wearable-preview-support.jar')
}
</pre>
</li>
<li>Click <strong>Sync Project with Gradle Files</strong> in the toolbar.</li>
</ol>
<p>To start optimizing your notifications for Android Wear,
read <a href="/wear/notifications/creating.html"
>Creating Notifications for Android Wear</a>.</p>
</body>
</html>
</div>
<div class="content-footer layout-content-row"
itemscope itemtype="http://schema.org/SiteNavigationElement">
<div class="layout-content-col col-9" style="padding-top:4px">
<div class="g-plusone" data-size="medium"></div>
</div>
<div class="paging-links layout-content-col col-4">
</div>
</div>
</div> <!-- end jd-content -->
<div id="footer" class="wrap" >
<div id="copyright">
Except as noted, this content is
licensed under <a href="http://creativecommons.org/licenses/by/2.5/">
Creative Commons Attribution 2.5</a>. For details and
restrictions, see the <a href="/license.html">Content
License</a>.
</div>
<div id="footerlinks">
<p>
<a href="/about/index.html">About Android</a> |
<a href="/legal.html">Legal</a> |
<a href="/support.html">Support</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<!-- Start of Tag -->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://2507573.fls.doubleclick.net/activityi;src=2507573;type=other026;cat=googl348;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
<!-- End of Tag -->
</body>
</html>
|