Slide 1

Slide 1 text

Android Wear Development David Vávra Avast Mobile

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Hardware BT Mic PM HR Display Battery Additional Price Available Samsung Galaxy Gear Live x x x x 320x320 AMOLED square 300 mAh: 1.5 day Charging cradle, IP67 $199 Google Play now LG G Watch x x x 280x280 LCD square 400 mAh: 1.5 day Charging cradle, IP67 $229 Google Play now Moto 360 x x x x 320x290 LCD round 320 mAh: 1 day Wireless charging, light sensor, IP67 $250 US now, UK October LG G Watch R x x x x 320x320 OLED round 410 mAh: 1.5 day Charging cradle, Barometer, IP67 $299? October Sony SmartWatch 3 x x x x 320x320 transflectiv e square 420 mAh: 2 days? microUSB, GPS, IP68, NFC, IP55 $299 autumn Asus ZenWatch x x x x 320x320 s AMOLED 369 mAh: 1 day Charging cradle, curved screen $260 autumn BT=Bluetooth Low Energy, PM=pedometer, HR=heart rate monitor, all=gyroscope, accel., compass

Slide 6

Slide 6 text

Design vision vs

Slide 7

Slide 7 text

Design principles Launched automatically Think about the stream first

Slide 8

Slide 8 text

Design guidelines Glanceable Zero or low interaction

Slide 9

Slide 9 text

Design principles Design for big gestures Do one thing really fast Don’t be a constant shoulder-tapper Don’t stop the user

Slide 10

Slide 10 text

WearSquare

Slide 11

Slide 11 text

Development: Two ways Extending notifications

Slide 12

Slide 12 text

Development: Two ways Native apps

Slide 13

Slide 13 text

Extending notifications // Create a WearableExtender to add functionality for wearables NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender() .setHintHideIcon(true); // Create a NotificationCompat.Builder to build a standard notification // then extend it with the WearableExtender Notification notif = new NotificationCompat.Builder(mContext) .setContentTitle("New mail from " + sender) .setContentText(subject) .setSmallIcon(R.drawable.new_mail); .extend(wearableExtender).build();

Slide 14

Slide 14 text

Paging notifications // Add second page with wearable extender Notification twoPageNotification = new WearableExtender() .addPage(secondPageNotification) .extend(notificationBuilder) .build(); // Issue the notification notificationManager = NotificationManagerCompat.from(this); notificationManager.notify(notificationId, twoPageNotification);

Slide 15

Slide 15 text

Stacking notifications Bitmap background = BitmapFactory.decodeResource(getResources(), R.drawable.ic_background); NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender() .setBackground(background); // Create an InboxStyle notification Notification summaryNotificationWithBackground = new NotificationCompat.Builder(mContext) .setContentTitle("2 new messages") ... .extend(wearableExtender) .setGroup(GROUP_KEY_EMAILS) .setGroupSummary(true).build();

Slide 16

Slide 16 text

Native apps ● packaged into phone app ● Android 4.4 KitKat ○ access all Android APIs except internet, bluetooth and usb ● are launched: ○ from your Service (custom notification) ○ using voice ○ third-party launcher ● are exited: ○ swipe right ○ palm ○ timeout ○ long press

Slide 17

Slide 17 text

GridViewPager & FragmentGridPagerAdaper

Slide 18

Slide 18 text

CardFragment & CircledImageView https://github.com/destil/WearSquare/blob/master/wear/src/main/java/cz/destil/wearsquare/fragment/ActionFragment.java

Slide 19

Slide 19 text

WearableListView & DelayedConfirmationView

Slide 20

Slide 20 text

ConfirmationActivity

Slide 21

Slide 21 text

UI for rounded screens ● android: windowOverscan=tr ue ○ layout_gravity=” center_vertical” ● WatchViewStub ○ different layout for round and square ● BoxInsetLayout ○ same layout for both ○ wearable: layout_box=”left|right”

Slide 22

Slide 22 text

Voice input ● System provided actions - Intents ○ take a note, set an alarm, start a run, … ● App provided voice action - MAIN Intent ○ “OK Google, start ” ● Free-form speech input ○ standard Intent

Slide 23

Slide 23 text

Sending and syncing data ● Only way of communicating with the phone ● Simple byte[] data, serialization required ● Managed by Google Play Services ● Teleport library ○ https://github.com/Mariuxtheone/Teleport

Slide 24

Slide 24 text

Sending and syncing data ● Activity (sending) or Service (receiving) ● Data types: ○ Messages mTeleportClient.sendMessage("/play/3333", null); ○ DataItems mTeleportClient.syncString("/message-text", "Hello, World!"); ○ Assets ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteStream); Asset asset = Asset.createFromBytes(byteStream.toByteArray()); mTeleportClient.syncAsset("/background", asset);

Slide 25

Slide 25 text

Example code https://github.com/destil/WearSquare

Slide 26

Slide 26 text

What apps are great on watch:

Slide 27

Slide 27 text

Q&A Documentation: ● http://developer.android.com/design/wear ● http://developer.android. com/training/building-wearables.html Follow me: ● http://google.com/+DavidVávra ● http://twitter.com/destil