Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

What's new in Android Wear 2.0

659 Aufrufe

Veröffentlicht am

Android Wear 2.0 is a major update and contains a number of significant updates that will make it easier to build delightful experiences for wearables. In this session, I will provide an overview of new features such as Standalone apps, Material Design on Android Wear and some of the new UI components we're making available (such as Navigation Drawers and Action Drawers), as well as complications and complication data providers.

Veröffentlicht in: Software
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

What's new in Android Wear 2.0

  1. 1. Peter Friese Developer Advocate, Google What’s New in Android Wear 2.0
  2. 2. Android Wear 2.0 Developer Preview
  3. 3. Android Wear 2.0 1. Material Design for Apps 2. Standalone 3. Watch faces 4. Messaging 5. Fitness
  4. 4. New User Interface
  5. 5. design.google.com
  6. 6. Material Design for Wearables google.com/design/spec-wear Components and app design patterns Vertical layouts Darker colors
  7. 7. Vertical layouts
  8. 8. Vertical layoutMulti-directional layout
  9. 9. Darker colors
  10. 10. Purple 500 App primary color
  11. 11. Purple 500 App primary color
  12. 12. google.com/design/spec-wear
  13. 13. Components and app design patterns
  14. 14. A B C D
  15. 15. WearableDrawerLayout
  16. 16. <WearableDrawerLayout> <FrameLayout android:id=”@+id/content” /> <WearableNavigationDrawer android:id=”@+id/top_drawer” android:layout_width=”match_parent” android:layout_height=”match_parent” /> <WearableActionDrawer android:id=”@+id/bottom_drawer” android:layout_width=”match_parent” android:layout_height=”match_parent” /> </WearableDrawerLayout> Defining the layout
  17. 17. Android Wear 2.0 Support Library dependencies { ... compile 'com.google.android.support:wearable:2.0.0-alpha3' } build.gradle
  18. 18. google.com/design/spec-wear g.co/wearpreview
  19. 19. Don’t forget Wear apps are “real” apps Always On Apps
  20. 20. Standalone Apps
  21. 21. Cloud and data Cloud DistributeAuth Notify
  22. 22. Direct network access HTTP REST
  23. 23. Direct network access ● Bluetooth to Phone Bluetooth Proxy ● Wifi ● LTE/Cellular Wifi, LTE/Cellular
  24. 24. Cloud and data HTTP REST Data Items HTTP REST
  25. 25. Authentication Auth DistributeCloud Notify
  26. 26. Standalone apps must manage auth Valid auth DataItems Valid auth
  27. 27. But time awaits no one... Don’t ask for auth if you don’t need it Or postpone auth, store data locally Else, focus user ease
  28. 28. Use a login activity Input fields with android:inputType set to textPassword for password keyboard.
  29. 29. Google Sign-in and Smart Lock for Passwords offer seamless sign-in. Google Sign-in Smart Lock for Passwords
  30. 30. Pass tokens via Data Layer This is fast and easy for user, but does not work on iOS. Valid auth Valid auth ?
  31. 31. Coming soon: Pass the user to OAuth flow on phone OAuth Service
  32. 32. Choosing auth methods Fast and easy for user Works with iOS Works without phone Available Google Sign-in Soon SmartLock for Passwords Soon Token over Data Layer Now OAuth URL Soon Activity on watch Now
  33. 33. Notifications and push Auth DistributeCloud Notify
  34. 34. Cloud messages can go directly to Wear FCM FCM ● GCM -> FCM
  35. 35. Use FCM to send cloud messages to watches ● Payloads can be user visible and/or data ● Works well with Doze ● Cross-platform
  36. 36. Android Notifications bridge from phone to watch
  37. 37. Disable bridging in AndroidManifest.xml <manifest package="com.example.standalone" xmlns:android="http://schemas.android.com/apk/res/android"> <application ...> <meta-data android:name="com.google.android.wearable.notificationBridgeMode" android:value="NO_BRIDGING" /> ...
  38. 38. Distribution and installation Auth DistributeCloud Notify
  39. 39. No more bundled APKs! Phone APK Embedded Wear APK Phone APK Wear APK ● Smaller phone apks ● Decoupled release process ● Per-architecture apks
  40. 40. Watch Feature in Android Manifest.xml <manifest package="com.example.standalone" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-feature android:name="android.hardware.type.watch"/> ... </manifest>
  41. 41. Turn off phone app bundling of wear apps dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) wearApp project(':wear') compile 'com.google.android.gms:play-services:8.4.0' }
  42. 42. Complications API
  43. 43. Introducing complications Sub Title
  44. 44. What’s a complication? In Horology, the study of clocks and watches, a complication refers to any feature in a timepiece beyond the simple display of hours and minutes. Source: Wikipedia
  45. 45. Bits Legacy
  46. 46. Watch faceData provider Complications API
  47. 47. Watch face
  48. 48. Data provider
  49. 49. Design Guidelines
  50. 50. Short text Icon Ranged value Long text Large imageSmall image
  51. 51. Where to position complications
  52. 52. Containing form factors
  53. 53. Building a strong relationship with the watch face
  54. 54. Multiple complications
  55. 55. More opportunity to get creative
  56. 56. Using the API
  57. 57. Watch faceData provider
  58. 58. Watch face Update request Data provider ComplicationData ComplicationData
  59. 59. watchface complicationid = 2 watchface complicationid = 1 Ranged Value Long Text Short Text Icon Ranged Value Short Text Icon
  60. 60. MyWatchFaceConfigActivity.java Intent intent = ComplicationHelperActivity.createProviderChooserIntent( getActivity(), watchfaceComponentName, watchFaceComplicationId, new int[] { ComplicationData.TYPE_RANGED_VALUE, ComplicationData.TYPE_SHORT_TEXT, ComplicationData.TYPE_ICON }); startActivityForResult(intent, REQ_CODE);
  61. 61. MyWatchFaceService.Engine @Override public void onCreate(SurfaceHolder holder) { ... setActiveComplications(watchFaceComplicationId1, watchFaceComplicationId2); } @Override public void onComplicationDataUpdate( int watchFaceComplicationId, ComplicationData data) { // do something with the data }
  62. 62. MyWatchFaceService.Engine @Override public void onDraw(Canvas canvas, Rect bounds) { ... if (complicationData.isActive(currentTimeMillis) { // draw the complication } ... } @Override public void onTapCommand(int tapType, int x, int y, long eventTime) { // check if a complication was tapped }
  63. 63. The watch face must have permission to show the provider chooser and to receive data. But these cases don't require permission: Safe system providers Provider and watch face from same app Provider whitelists watch face as safe watch face Permissions
  64. 64. AndroidManifest.xml <uses-permission android:name= "com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA"/>
  65. 65. Watch faceData provider
  66. 66. MyComplicationProviderService.java @Override public void onComplicationUpdate( int complicationId, int type, ComplicationManager manager) { if (type == ComplicationData.TYPE_SHORT_TEXT) { ComplicationData data; data = new ComplicationData.Builder(ComplicationData.TYPE_SHORT_TEXT) .setShortText(ComplicationText.plainText("hello")) .setIcon(Icon.createWithResource( getPackageName(), R.drawable.icon)) .build(); manager.updateComplicationData(complicationId, data); } }
  67. 67. AndroidManifest.xml <meta-data android:name="android.support.wearable.complications.SUPPORTED_TYPES" android:value="RANGED_VALUE,SHORT_TEXT,ICON"/> <meta-data android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" android:value="300"/>
  68. 68. TimeDifferenceText TimeFormatText
  69. 69. MyComplicationProviderService.java data = new ComplicationData.Builder(ComplicationData.TYPE_SHORT_TEXT) .setShortText(new ComplicationText.TimeDifferenceBuilder() .setReferencePeriodStart(startTime) .setReferencePeriodEnd(endTime) .setStyle(ComplicationText.DIFFERENCE_STYLE_SHORT_DUAL_UNIT) .build()) .setEndTime(endTime) .build();
  70. 70. Watch faceData provider Complications API
  71. 71. Introducing complications Sub Title
  72. 72. Android Wear 2.0 1. System UI and Material Design 2. Standalone 3. Watch faces 4. Messaging 5. Fitness
  73. 73. g.co/wearpreview
  74. 74. g.co/wearpreview Bugs, API suggestions? Android Wear Developer Preview Issue tracker g.co/wearpreviewbug Discussion Android Wear G+ Community g.co/androidweardev
  75. 75. Peter Friese @peterfriese Thank You!

×