2. • Android SDK
• ADT plugin for Eclipse v22.6.1+
• Install ‘Android Wear ARM EABI v7a System
Image’
• Use the latest version of ‘Android Support
Library’
• Set Up the Android Wear Emulator
開發環境
214年5月15⽇日星期四
13. •Designing for Android Wear is substantially
different than designing for phones or tablets.
•Android phones 與 tablets 是 UI、functionality 與
Touch 導向
•Android wear 是 Notification 導向
Android Wear App 的設計
1314年5月15⽇日星期四
14. The Context Stream
On the Android wearable, each notification
appears as a new card in the context stream.
The Cue Card
Allows users to speak to their device. There are
a list of actions. The list of actions includes
Android intents for voice actions.
UI Principles
Portions of this page are reproduced from work created and shared by the Android Open Source Project and
used according to terms described in the Creative Commons 2.5 Attribution License.
1414年5月15⽇日星期四
16. private void zero() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setContentTitle("Zero")
.setContentText("You're at step zero.")
.setSmallIcon(R.drawable.bg_eliza);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(0x07, builder.build());
}
Portions of this page are reproduced from work created and shared by the Android Open Source Project and
used according to terms described in the Creative Commons 2.5 Attribution License.
Step Zero
1614年5月15⽇日星期四
26. •Android wearables provide just the right
information at just the right time, allowing you to
be connected to the virtual world and present in
the real world.
•Android Devices (Phone/Table) 的週邊
•Android Wear 是 Notification 裝置
•Android Devices 的 Second Device
•PDA (輔具)
Android Wear 的哲學
2614年5月15⽇日星期四
37. private void appTwo() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setContentTitle("80% Discount")
.setContentText("Now products are there...")
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.bg_mountain));
Intent intent = new Intent(ACTION_RESPONSE);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent,
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT);
builder.setContentIntent(pendingIntent);
// 1. Create a big text style for the second page
BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
secondPageStyle.setBigContentTitle("New Product")
.bigText("A lot of text...");
// 2. Create second page notification with big text style
Notification secondPageNotification = new NotificationCompat.Builder(this)
.setStyle(secondPageStyle)
.build();
Notification notification = new WearableNotifications.Builder(builder)
.setMinPriority()
.setHintHideIcon(true)
// 3. Add the second page to notification
.addPage(secondPageNotification)
.build();
NotificationManagerCompat.from(this).notify(0x01, notification);
}
3714年5月15⽇日星期四
38. private void appThree() {
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setContentTitle("Coupon")
.setContentText("Limited. 30 mins from now !")
.setLargeIcon(BitmapFactory.decodeResource(getResources(),
R.drawable.bg_mountain));
Intent intent = new Intent(ACTION_RESPONSE);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent,
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT);
builder.setContentIntent(pendingIntent);
Notification notification = new WearableNotifications.Builder(builder)
.setMinPriority()
.setHintHideIcon(true)
.addRemoteInputForContentIntent(
new RemoteInput.Builder("GET !")
.setLabel("Reply").build())
.build();
NotificationManagerCompat.from(this).notify(0x02, notification);
}
3814年5月15⽇日星期四
39. Notification notification = new WearableNotifications.Builder(builder)
.setMinPriority()
.setHintHideIcon(true)
.addRemoteInputForContentIntent(
new RemoteInput.Builder("GET !")
.setLabel("Reply")
.setChoices(getResources().getStringArray(R.array.reply_choices))
.build())
.build();
Use .setChoices()
3914年5月15⽇日星期四