Slide 1

Slide 1 text

Android Wear 2.0 Great Changes Upcoming this Fall Royce Mars Organizer @ GDG Dnipro Senior Developer @ DataArt

Slide 2

Slide 2 text

David Singleton, VP of Engineering at Google

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

What you can do with the new generation watches? And why? :)

Slide 5

Slide 5 text

Hardware Key platform features and supported watches

Slide 6

Slide 6 text

#dfua Goodbye tethering! BLE WiFi Cellular

Slide 7

Slide 7 text

#dfua Great chances to get direct access to Play

Slide 8

Slide 8 text

#dfua Officially supported watches LG Watch Urbane 2nd Edition Huawei Watch

Slide 9

Slide 9 text

#dfua Officially supported watches LG Watch Urbane 2nd Edition Huawei Watch Display: 1.4 inches, 400 x 400 pixels (~286 ppi) CPU:Quad-core 1.2 GHz Cortex-A7 GPU: Adreno 305, Chipset: Qualcomm Snapdragon 400 Memory: 4 GB, 512 MB RAM Comm: Wi-Fi 802.11 b/g, Bluetooth v4.1 LE Network: No cellular connectivity Battery: 300 mAh (48h) Display: 1.38 inches, 480 x 480 pixels (~348 ppi) CPU: Quad-core 1.2 GHz Cortex-A7 GPU: Adreno 305, Chipset: Qualcomm Snapdragon 400 Memory: 4 GB, 768 MB RAM Comm: Wi-Fi 802.11 b/g, Bluetooth v4.1 LE, GPS, NFC Network: GSM, HSPA, LTE Battery: 570 mAh (60h)

Slide 10

Slide 10 text

Complications Personal expression and utility

Slide 11

Slide 11 text

#dfua Personal expression and utility Modern by LG Ranger by Zuhanden GoogleFit Today

Slide 12

Slide 12 text

#dfua Or simply an personal expression :) HeyKittyKitty by WatchMaster

Slide 13

Slide 13 text

#dfua Complications “any feature in a timepiece beyond the simple display of hours and minutes” (Wikipedia)

Slide 14

Slide 14 text

#dfua Complication types -Short text -Long text -Range of values -Icon (small picture) -Image (big picture)

Slide 15

Slide 15 text

Complications coding

Slide 16

Slide 16 text

#dfua Each position need to be identified private static final int LEFT_DIAL_COMPLICATION = 0; private static final int RIGHT_DIAL_COMPLICATION = 1; public static final int[] COMPLICATION_IDS = {LEFT_DIAL_COMPLICATION, RIGHT_DIAL_COMPLICATION}; Complication ID

Slide 17

Slide 17 text

#dfua Each position must be mapped with array of supported types // Left and right dial supported types. public static final int[][] COMPLICATION_SUPPORTED_TYPES = { {ComplicationData.TYPE_SHORT_TEXT}, {ComplicationData.TYPE_SHORT_TEXT} }; Complication supported types

Slide 18

Slide 18 text

#dfua Data Providers and system trigger .onComplicationDataUpdate() sometimes /* Called when there is updated data for a complication id. */ @Override public void onComplicationDataUpdate( int complicationId, ComplicationData complicationData) { Log.d(TAG, "onComplicationDataUpdate() id: " + complicationId); mActiveComplicationDataSparseArray.put(complicationId, complicationData); invalidate(); } ComplicationData receiving

Slide 19

Slide 19 text

#dfua .onDraw() is the moment of drawing. ComplicationData where stored earlier @Override public void onDraw(Canvas canvas, Rect bounds) { ComplicationData complicationData; for (int i = 0; i < COMPLICATION_IDS.length; i++) { complicationData = mActiveComplicationDataSparseArray .get(COMPLICATION_IDS[i]); // ... Complications rendering

Slide 20

Slide 20 text

#dfua Complication may be deactivated or contain wrong data type if ((complicationData != null) && (complicationData.isActive(currentTimeMillis)) && (complicationData.getType() == ComplicationData.TYPE_SHORT_TEXT)) { ComplicationText mainText = complicationData.getShortText(); CharSequence complicationMessage = mainText.getText(getApplicationContext(), currentTimeMillis); Complications rendering

Slide 21

Slide 21 text

#dfua Actual drawing is trivial canvas.drawText( complicationMessage, 0, complicationMessage.length(), complicationsX, mComplicationsY, mComplicationPaint); Complications rendering

Slide 22

Slide 22 text

Data Providers

Slide 23

Slide 23 text

#dfua Android Wear role in data exchange

Slide 24

Slide 24 text

#dfua Data Providers

Slide 25

Slide 25 text

Data Providers coding

Slide 26

Slide 26 text

#dfua Data Provider Service attributes Extend ComplicationProviderService

Slide 27

Slide 27 text

#dfua Data Provider declaration

Slide 28

Slide 28 text

#dfua Update period Data Provider declaration

Slide 29

Slide 29 text

#dfua @Override public void onComplicationActivated( int complicationId, int dataType, ComplicationManager complicationManager) { … } @Override public void onComplicationUpdate( int complicationId, int dataType, ComplicationManager complicationManager) { … } @Override public void onComplicationDeactivated(int complicationId) { … } Data Provider methods

Slide 30

Slide 30 text

#dfua @Override public void onComplicationUpdate(int complicationId, int dataType, ComplicationManager complicationManager) { // Retrieve or generate your data int randomNumber = (int) Math.floor(Math.random() * 10); String randomNumberText = String.format(Locale.getDefault(), "%d!", randomNumber); Exposing data to complications Called according to update period time

Slide 31

Slide 31 text

#dfua ComplicationData complicationData = null; switch (dataType) { case ComplicationData.TYPE_SHORT_TEXT: complicationData = new ComplicationData.Builder( ComplicationData.TYPE_SHORT_TEXT) .setShortText(ComplicationText.plainText(randomNumberText)) .build(); break; Exposing data to complications

Slide 32

Slide 32 text

#dfua @Override public void onComplicationUpdate( int complicationId, int dataType, ComplicationManager complicationManager) { … if (complicationData != null) { complicationManager.updateComplicationData( complicationId, complicationData); } Exposing data to complications

Slide 33

Slide 33 text

Notifications updated

Slide 34

Slide 34 text

#dfua Notifications in Android Wear 1.X

Slide 35

Slide 35 text

#dfua Android Wear 2.0 Notifications Material Design for Wearables, Dark Theme

Slide 36

Slide 36 text

#dfua Android Wear 2.0 Notifications

Slide 37

Slide 37 text

#dfua Notifications preview

Slide 38

Slide 38 text

#dfua Notifications messaging style

Slide 39

Slide 39 text

Notifications coding

Slide 40

Slide 40 text

#dfua Notification noti = new NotificationCompat.Builder() .setContentTitle(messages.length + " new messages with " + sender) .setContentText("subject") .setSmallIcon(R.drawable.new_message) // 2) set the style to MessagingStyle .setStyle(new NotificationCompat.MessagingStyle( getResources().getString(R.string.reply_name)) .addMessage(messages[0]) .addMessage(messages[1]); Notifications with modern MessagingStyle set MessagingStyle

Slide 41

Slide 41 text

#dfua NotificationCompat.Action action = new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon, getString(R.string.label), replyPendingIntent) .addRemoteInput(remoteInput) .setAllowGeneratedReplies(true) .build(); Notifications with SmartReply Allow SmartReply

Slide 42

Slide 42 text

New Input Methods

Slide 43

Slide 43 text

#dfua New input methods

Slide 44

Slide 44 text

#dfua Voice input, Emoji

Slide 45

Slide 45 text

#dfua Keyboard, Handwriting

Slide 46

Slide 46 text

#dfua Wait, a Keyboard??? LG Watch Urbane 2nd Edition Display: 1.38 inches, 480 x 480 pixels (~348 ppi) CPU: Quad-core 1.2 GHz Cortex-A7 GPU: Adreno 305, Chipset: Qualcomm Snapdragon 400 Memory: 4 GB, 768 MB RAM Comm: Wi-Fi 802.11 b/g, Bluetooth v4.1, LE, GPS, NFC Network: GSM, HSPA, LTE Battery: 570 mAh (60h) Size x2 bigger than first phones

Slide 47

Slide 47 text

Material Design for Wearables

Slide 48

Slide 48 text

#dfua 1D Layout Do Don’t

Slide 49

Slide 49 text

#dfua UI Anatomy

Slide 50

Slide 50 text

#dfua Navigation Drawer

Slide 51

Slide 51 text

#dfua Action Drawer

Slide 52

Slide 52 text

#dfua Dark Theme

Slide 53

Slide 53 text

#dfua Brightness values 1 App color - Default color 2 Dark background - 15% 3 Lighter background - 30% 4 UI element - 40% 5 Lighter UI element - 65% 6 Accent - 100%

Slide 54

Slide 54 text

#dfua Interaction types

Slide 55

Slide 55 text

Quick look at Google Fit

Slide 56

Slide 56 text

#dfua Wearables area at Google I/O

Slide 57

Slide 57 text

#dfua Google Fit infrastructure

Slide 58

Slide 58 text

#dfua Existing Google Fit APIs Sensors API Recording API History API

Slide 59

Slide 59 text

#dfua Upcoming APIs Beat to Beat API Goals API Profile API

Slide 60

Slide 60 text

#dfua Real Time Gym Activity Recognition

Slide 61

Slide 61 text

#dfua Real Time Gym Activity Recognition Live demo from Google I/O

Slide 62

Slide 62 text

#dfua Recognized exercises

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

Thank you! QA? Royce Mars @RoyceMars