june 2014 - android wear

Post on 27-Jan-2015

106 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

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

TRANSCRIPT

INTRODUCTION TO �

ANDROID WEAR

Amrit Sanjeev Google Developer Expert

Agenda

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

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

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

Android wear�The next level of integration

Coming soon

Interacting for Android wear�Roll up your sleeves

Talk to the wearable

Take actions

the wearable talks to you

actions actions

context

Notifications

NO WORK REQUIRED

Notifications

Stacks Pages Replies

Setting up your developer environment�Roll up your sleeves

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

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

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)

��

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

Things to take care of �think before acting

Keep in mind

Read the design guidelines

Be context aware

Show relevant actions

Think before you notify

Wearable special functionality

Some code snippets �

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();

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);

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();

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);

top related