android wear 2.0 - it nonstop dnipro
TRANSCRIPT
![Page 1: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/1.jpg)
Android Wear 2.0 New level of freedom for your action
Докладчик: Constantine MarsSenior Developer @ DataArt,Co-Organizer @ GDG Dnipro+ConstantineMars
![Page 2: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/2.jpg)
![Page 3: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/3.jpg)
David Singleton, VP Engineering at Google
![Page 4: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/4.jpg)
![Page 5: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/5.jpg)
So… What’s coming in Android Wear 2.0?
![Page 6: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/6.jpg)
Problem No.1: Tethering
![Page 7: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/7.jpg)
Freedom from tetheringmeans “freedom without phone”
![Page 8: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/8.jpg)
Officially supported by:● LGE Watch Urbane
2nd Edition● Huawei Watch
Android Wear 2.0 Preview is available for
![Page 9: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/9.jpg)
Upcoming: access Market directly from watch
![Page 10: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/10.jpg)
What makes custom Watch Faces different but at the same time similar?
![Page 11: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/11.jpg)
Complications- “any feature in a timepiece beyond the simple display of hours and
minutes” (Wikipedia)
![Page 12: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/12.jpg)
● Short text● Long text● Range of values● Icon (small picture)● Image (big picture)
Complication types:
![Page 13: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/13.jpg)
Complications coding
![Page 14: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/14.jpg)
Each complication should have unique id
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};
// Left and right dial supported types.
public static final int[][] COMPLICATION_SUPPORTED_TYPES = {
{ComplicationData.TYPE_SHORT_TEXT},
{ComplicationData.TYPE_SHORT_TEXT}
};
![Page 15: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/15.jpg)
ComplicationData type stores complication info (text, icon, type)
onComplicationDataUpdate() is initiated by Data Provider
private SparseArray<ComplicationData> mActiveComplicationDataSparseArray;
…
@Override
public void onComplicationDataUpdate(
int complicationId, ComplicationData complicationData) {
Log.d(TAG, "onComplicationDataUpdate() id: " + complicationId);
// Adds/updates active complication data in the array.
mActiveComplicationDataSparseArray.put(complicationId, complicationData);
invalidate();
}
![Page 16: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/16.jpg)
Rendering complications
private void drawComplications(Canvas canvas, long currentTimeMillis) { // onDraw()
for (int i = 0; i < COMPLICATION_IDS.length; i++) {
ComplicationData complicationData = mActiveComplicationDataSparseArray.get(COMPLICATION_IDS[i]);
if ((complicationData != null) && (complicationData.isActive(currentTimeMillis))
&& (complicationData.getType() == ComplicationData.TYPE_SHORT_TEXT)) {
ComplicationText mainText = complicationData.getShortText();
canvas.drawText( mainText, 0, mainText.length(),
complicationsX, mComplicationsY, mComplicationPaint);
![Page 17: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/17.jpg)
Data Providerswill stand behind the scenes as sources of data for
complications
![Page 18: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/18.jpg)
One complication may use different providers as the data source
![Page 19: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/19.jpg)
DataProviders coding
![Page 20: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/20.jpg)
Extend ComplicationProviderServiceand declare it in AndroidManifest.xml
android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST
android:icon
android.support.wearable.complications.UPDATE_PERIOD_SECONDS
android.support.wearable.complications.PROVIDER_CONFIG_ACTION
<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="SHORT_TEXT"/>
![Page 21: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/21.jpg)
ComplicationProviderServiceinternals
onComplicationActivated()
onComplicationUpdate()
onComplicationDeactivated()
![Page 22: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/22.jpg)
Exposing data from providerin onComplicationUpdate()
@Override
public void onComplicationUpdate(int complicationId, int dataType, ComplicationManager complicationManager) {
int randomNumber = (int) Math.floor(Math.random() * 10);
String randomNumberText = String.format(Locale.getDefault(), "%d!", randomNumber);
switch (dataType) {
case ComplicationData.TYPE_SHORT_TEXT:
ComplicationData complicationData = new ComplicationData.Builder(ComplicationData.TYPE_SHORT_TEXT)
.setShortText(ComplicationText.plainText(randomNumberText))
.build();
break;
...
![Page 23: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/23.jpg)
Exposing data from providerTrigger update with ComplicationManager.updateComplicationData()
@Override
public void onComplicationUpdate(int complicationId, int dataType, ComplicationManager complicationManager) {
...
if (complicationData != null) {
complicationManager.updateComplicationData(complicationId, complicationData);
}
![Page 24: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/24.jpg)
What whas really distracting in AndroidWear 1.X notifications?
White light when you receive notification
![Page 25: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/25.jpg)
Visual updates to notifications in 2.0Dark theme, Material Design for Android Wear
![Page 26: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/26.jpg)
Large dark notificationEasier to read, but less-distracting in everyday life
![Page 27: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/27.jpg)
Notifications and messages
![Page 28: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/28.jpg)
Notification MessagingStyle
![Page 29: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/29.jpg)
Allow smart replies, based on Google Assistant
NotificationCompat.Action action =
new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon,
getString(R.string.label), replyPendingIntent)
.addRemoteInput(remoteInput)
// 1) allow generated replies
.setAllowGeneratedReplies(true)
.build();
![Page 30: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/30.jpg)
Use MessagingStyle for notification
Notification noti = new NotificationCompat.Builder()
.setContentTitle(messages.length + " new messages with " + sender.toString())
.setContentText(subject)
.setSmallIcon(R.drawable.new_message)
.setLargeIcon(aBitmap)
// 2) set the style to MessagingStyle
.setStyle(new NotificationCompat.MessagingStyle(resources.getString(R.string.reply_name))
.addMessage(messages[0].getText(), messages[0].getTime(), messages[0].getSender())
.addMessage(messages[1].getText(), messages[1].getTime(), messages[1].getSender()))
![Page 31: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/31.jpg)
Response to notifications in AndroidWear 1.X“Voice input”
![Page 32: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/32.jpg)
More input methodsHandwriting, suggestions, keyboard
![Page 33: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/33.jpg)
1.38-inch full circle P-OLED480 x 480348ppi
How full-size keyboard works on the small screen?
![Page 34: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/34.jpg)
“Magic button” - center of navigation concepts
![Page 35: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/35.jpg)
The most complicated UI pattern of AndroidWear 1.X?- “2D Picker”
![Page 36: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/36.jpg)
The answer to this problem in AndroidWear 2- Recommended pattern is “1D Layouts”
![Page 37: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/37.jpg)
App Layout examples
![Page 38: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/38.jpg)
Material Design: Navigation and Action Drawers
![Page 39: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/39.jpg)
WearableDrawerLayoutand it’s internals
<android.support.wearable.view.drawer.WearableDrawerLayout
...>
<FrameLayout
.../>
<android.support.wearable.view.drawer.WearableNavigationDrawer
.../>
<android.support.wearable.view.drawer.WearableActionDrawer
.../>
</android.support.wearable.view.drawer.WearableDrawerLayout>
![Page 40: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/40.jpg)
Material Design: Navigation and Action Drawers
![Page 41: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/41.jpg)
Material Design: Dark Theme
![Page 42: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/42.jpg)
Android Wear Area at Google I/O
![Page 43: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/43.jpg)
GoogleFit infrastructure
![Page 44: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/44.jpg)
Well known GoogleFit APIs
![Page 45: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/45.jpg)
GoogleFit: upcoming APIs
![Page 46: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/46.jpg)
GoogleFit: upcoming features of existing APIs
![Page 47: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/47.jpg)
GoogleFit - gym activity recognition
![Page 48: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/48.jpg)
GoogleFit live demo on Google I/O
![Page 49: Android Wear 2.0 - IT NonStop Dnipro](https://reader034.vdocument.in/reader034/viewer/2022042600/587e32101a28abb93e8b7269/html5/thumbnails/49.jpg)
Activity recognition accuracy