27
INTRODUCTION TO ANDROID WEAR Amrit Sanjeev Google Developer Expert

June 2014 - Android wear

Embed Size (px)

DESCRIPTION

Amrit Sanjeev talks about Android Wear, what it is, why is it useful, and how you can get your apps use things related to Android Wear

Citation preview

Page 1: June 2014 - Android wear

INTRODUCTION TO �

ANDROID WEAR

Amrit Sanjeev Google Developer Expert

Page 2: June 2014 - Android wear

Agenda

•  About me •  Blrdroid GDG •  Android Wear introduction •  Q&A

Page 3: June 2014 - Android wear

About me

•  Organizer, Bangalore Android User Group ( www.blrdroid.org )

•  Google Developer Expert (GDE) for Android.

•  Part of Intel Android Influencer program.

•  Staff engineer for Mobile at Digital Insight (formerly Intuit).

•  Previous companies – Philips research, IBM.

•  Mentor at 10,000 startups

Page 4: June 2014 - Android wear

Bangalore Android User Group ( www.BlrDroid.org)

•  Largest open Android developer community in the India

•  Over 5100+ members

•  4.5+ years and completely free.

•  54 meet-ups

•  5 hackathons

•  Blrdroid teach – College edition more than 2300+ students from over 35 colleges participated.

•  Active participation in events like Droidcon, Global Android

Developer hackathon, Google Bizdroid etc

Page 5: June 2014 - Android wear

Android wear�The next level of integration

Page 6: June 2014 - Android wear
Page 7: June 2014 - Android wear
Page 8: June 2014 - Android wear
Page 9: June 2014 - Android wear

Coming soon

Page 10: June 2014 - Android wear

Interacting for Android wear�Roll up your sleeves

Page 11: June 2014 - Android wear

Talk to the wearable

Take actions

the wearable talks to you

actions actions

context

Page 12: June 2014 - Android wear

Notifications

Page 13: June 2014 - Android wear

NO WORK REQUIRED

Page 14: June 2014 - Android wear

Notifications

Stacks Pages Replies

Page 15: June 2014 - Android wear

Setting up your developer environment�Roll up your sleeves

Page 16: June 2014 - Android wear

Prerequisites

●  On computer ●  Install Android Studio / Eclipse bundle ●  Sign up for Android Wear Development Preview ●  Install the preview support library

●  On device ●  Install Android Wear Preview beta app

Page 17: June 2014 - Android wear

Install Android Wear System Image

●  Android SDK Tools revision 22.6 or higher ●  Android Wear ARM EABI v7a System Image ●  Update Android Support Library ●  Download the wearable preview support jar

Page 18: June 2014 - Android wear

Setup the Android Wear Emulator

●  Launch the Android Virtual Device Manager ●  Target Android 4.4.2 - API Level 19 ●  CPU Android Wear ARM (armeabi-v7a)

Page 19: June 2014 - Android wear

��

Setup Android Wear Preview app

●  Settings: grant notification access ●  Connect your device over USB ●  adb -d forward tcp:5601 tcp:5601 ●  If the icon in the emulator changes to “g” -

Good

Page 20: June 2014 - Android wear

Things to take care of �think before acting

Page 21: June 2014 - Android wear

Keep in mind

Read the design guidelines

Be context aware

Show relevant actions

Think before you notify

Wearable special functionality

Page 22: June 2014 - Android wear

Some code snippets �

Page 23: June 2014 - Android wear

Wearable only functionality

// Create a NotificationCompat.Builder for standard notification features NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext) .setContentTitle("New mail from " + sender.toString()) .setContentText(subject) .setSmallIcon(R.drawable.new_mail); // Create a WearablesNotification.Builder to add special functionality for wearables

Notification notification = new WearableNotifications.Builder(notificationBuilder) .setHintHideIcon(true) .build();

Page 24: June 2014 - Android wear

Adding actions

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_event) .setContentTitle(eventTitle) .setContentText(eventLocation) .setContentIntent(viewPendingIntent) .addAction(R.drawable.ic_map, getString(R.string.map),

mapPendingIntent);

Page 25: June 2014 - Android wear

Multipage notifications

// Create builder for the main notification NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)…… // Create a big text style for the second page BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle(); secondPageStyle.setBigContentTitle("Page 2") .bigText("A lot of text..."); // Create second page notification Notification secondPageNotification = new NotificationCompat.Builder(this) .setStyle(secondPageStyle) .build(); // Create main notification and add the second page Notification twoPageNotification = new WearableNotifications.Builder(notificationBuilder) .addPage(secondPageNotification) .build();

Page 26: June 2014 - Android wear

Stacked notifications

Notification notif1 = new WearableNotifications.Builder(builder) .setGroup(GROUP_KEY_EMAILS) .build(); // Issue the notification NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this); notificationManager.notify(notificationId1, notif); builder = new NotificationCompat.Builder(mContext) .setContentTitle("New mail from " + sender2) .setContentText(subject2) .setSmallIcon(R.drawable.new_mail); // Use the same group as the previous notification Notification notif2 = new WearableNotifications.Builder(builder) .setGroup(GROUP_KEY_EMAILS) .build(); notificationManager.notify(notificationId2, notif);

Page 27: June 2014 - Android wear