Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Android Wear – IO Extended
Search
Douglas Kayama
May 28, 2015
Technology
0
37
Android Wear – IO Extended
Apresentação sobre Android Wear pré-hackathon no IO Extended Campinas 2015
Douglas Kayama
May 28, 2015
Tweet
Share
More Decks by Douglas Kayama
See All by Douglas Kayama
TensorFlow no Android – v2
douglasdrumond
0
29
BLE
douglasdrumond
0
29
TensorFlow no Android
douglasdrumond
0
20
Firebase or Realm?
douglasdrumond
0
78
Rio Dev Day – Introdução ao Android
douglasdrumond
0
97
Google I/O
douglasdrumond
0
61
Criando apps com alto nível de qualidade (versão longa)
douglasdrumond
0
39
Criando apps com alto nível de qualidade (versão curta)
douglasdrumond
0
27
Primeiros Passos com Google Fit
douglasdrumond
0
190
Other Decks in Technology
See All in Technology
室長と気ままに学ぶマイクロソフトのビジネスアプリケーションとビジネスプロセス
ryoheig0405
0
360
バックエンドエンジニアのためのフロントエンド入門 #devsumiC
panda_program
18
7.3k
一度 Expo の採用を断念したけど、 再度 Expo の導入を検討している話
ichiki1023
1
160
エンジニアが加速させるプロダクトディスカバリー 〜最速で価値ある機能を見つける方法〜 / product discovery accelerated by engineers
rince
0
120
リーダブルテストコード 〜メンテナンスしやすい テストコードを作成する方法を考える〜 #DevSumi #DevSumiB / Readable test code
nihonbuson
11
7.1k
地方拠点で エンジニアリングマネージャーってできるの? 〜地方という制約を楽しむオーナーシップとコミュニティ作り〜
1coin
1
220
ホワイトボードチャレンジ 説明&実行資料
ichimichi
0
130
飲食店予約台帳を支えるインタラクティブ UI 設計と実装
siropaca
7
1.7k
人はなぜISUCONに夢中になるのか
kakehashi
PRO
6
1.6k
白金鉱業Meetup Vol.17_あるデータサイエンティストのデータマネジメントとの向き合い方
brainpadpr
5
600
データマネジメントのトレードオフに立ち向かう
ikkimiyazaki
6
830
Helm , Kustomize に代わる !? 次世代 k8s パッケージマネージャー Glasskube 入門 / glasskube-entry
parupappa2929
0
250
Featured
See All Featured
Designing for Performance
lara
604
68k
Building Applications with DynamoDB
mza
93
6.2k
Building a Scalable Design System with Sketch
lauravandoore
461
33k
A Philosophy of Restraint
colly
203
16k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
9
440
GraphQLとの向き合い方2022年版
quramy
44
13k
We Have a Design System, Now What?
morganepeng
51
7.4k
Fontdeck: Realign not Redesign
paulrobertlloyd
83
5.4k
KATA
mclloyd
29
14k
Unsuck your backbone
ammeep
669
57k
Agile that works and the tools we love
rasmusluckow
328
21k
The World Runs on Bad Software
bkeepers
PRO
67
11k
Transcript
Android Wear Douglas Drumond
[email protected]
None
None
None
Background
None
None
Coding
Not Coding
Notifications
Notifications
Notifications
Notifications Nada a ser feito
Enhanced notifications
Enhanced notifications Nada a ser feito
Coding
Ação só p/ relógio // Create an intent for the
reply action Intent actionIntent = new Intent(this, ActionActivity.class); PendingIntent actionPendingIntent = PendingIntent.getActivity(this, 0, actionIntent, PendingIntent.FLAG_UPDATE_CURRENT); // Create the action NotificationCompat.Action action = new NotificationCompat.Action.Builder(R.drawable.ic_action, getString(R.string.label), actionPendingIntent) .build(); // Build the notification and add the action via WearableExtender Notification notification = new NotificationCompat.Builder(mContext) .setSmallIcon(R.drawable.ic_message) .setContentTitle(getString(R.string.title)) .setContentText(getString(R.string.content)) .extend(new WearableExtender().addAction(action)) .build();
Voz // Key for the string that's delivered in the
action's intent private static final String EXTRA_VOICE_REPLY = "extra_voice_reply"; String replyLabel = getResources().getString(R.string.reply_label); RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY) .setLabel(replyLabel) .build();
Voz com opções public static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
... String replyLabel = getResources().getString(R.string.reply_label); String[] replyChoices = getResources().getStringArray(R.array.reply_choices); RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY) .setLabel(replyLabel) .setChoices(replyChoices) .build();
Voz // Create an intent for the reply action Intent
replyIntent = new Intent(this, ReplyActivity.class); PendingIntent replyPendingIntent = PendingIntent.getActivity(this, 0, replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); // Create the reply action and add the remote input NotificationCompat.Action action = new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon, getString(R.string.label), replyPendingIntent) .addRemoteInput(remoteInput) .build(); // Build the notification and add the action via WearableExtender Notification notification = new NotificationCompat.Builder(mContext) .setSmallIcon(R.drawable.ic_message) .setContentTitle(getString(R.string.title)) .setContentText(getString(R.string.content)) .extend(new WearableExtender().addAction(action)) .build();
Voz private CharSequence getMessageText(Intent intent) { Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
if (remoteInput != null) { return remoteInput.getCharSequence(EXTRA_VOICE_REPLY); } return null; }
Paginação
Paginação NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.new_message) .setContentTitle("Page 1") .setContentText("Short
message") .setContentIntent(viewPendingIntent);
Paginação 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();
Paginação // Extend the notification builder with the second page
Notification notification = notificationBuilder .extend(new NotificationCompat.WearableExtender() .addPage(secondPageNotification)) .build();
Pilha
Pilha setGroup com mesmo ID
Pilha Notification notif = new NotificationCompat.Builder(mContext) .setContentTitle("New mail from "
+ sender1) .setContentText(subject1) .setSmallIcon(R.drawable.new_mail) .setGroup(GROUP_KEY_EMAILS) .build(); … Notification notif2 = new NotificationCompat.Builder(mContext) .setContentTitle("New mail from " + sender2) .setContentText(subject2) .setSmallIcon(R.drawable.new_mail) .setGroup(GROUP_KEY_EMAILS) .build();
Wearable Apps
O que não tem • android.webkit • android.print • android.app.backup
• android.appwidget • android.hardware.usb
Requisitos • SDK tools versão 23.0.0 ou superior • SDK
Android 4.4W (API 20)
Custom notification public void onCreate(Bundle bundle){ ... setContentView(R.layout.notification_activity); } <activity
android:name="com.example.NotificationActivity" android:exported="true" android:allowEmbedded="true" android:theme="@android:style/Theme.DeviceDefault.Light" /> Intent notificationIntent = new Intent(this, NotificationActivity.class); PendingIntent notificationPendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Layouts <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:id="@+id/text"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_square" /> </LinearLayout>
Layouts
Layouts compile 'com.google.android.support:wearable:+'
Layouts <android.support.wearable.view.WatchViewStub xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/watch_view_stub" android:layout_width="match_parent" android:layout_height="match_parent" app:rectLayout="@layout/rect_activity_wear" app:roundLayout="@layout/round_activity_wear">
</android.support.wearable.view.WatchViewStub>
Layouts @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wear); }
Layouts <android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_height="match_parent" android:layout_width=“match_parent> … </android.support.wearable.view.BoxInsetLayout>
Layouts
Layouts • android.support.wearable.view.BoxInsetLayout • android.support.wearable.view.CardScrollView • android.support.wearable.view.CardFrame • android.support.wearable.view.WearableListView •
WearableListView.Adapter
O que mais? • Transferência de dados entre wearable e
device: • Wearable Data Layer • Cloud sync • getConnectedNodes(), MessageApi, NodeApi, CapabilityApi
O que mais? • Watch Face: • CanvasWatchFaceService, CanvasWatchFaceService.Engine… •
Always-on Apps • Browse media (android.media.browse API)
Próximos passos? • http://developer.android.com/wear/
WatchFace • https://github.com/ustwo/Clockwise • http://wear.ustwo.com
Obrigado
Obrigado +DouglasDrumond @douglasdrumond www.cafelinear.com www.robotodojo.com
[email protected]
+GdgCampinasOrg @gdgcampinas www.gdg-campinas.org