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
28
BLE
douglasdrumond
0
29
TensorFlow no Android
douglasdrumond
0
19
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
37
Criando apps com alto nível de qualidade (versão curta)
douglasdrumond
0
25
Primeiros Passos com Google Fit
douglasdrumond
0
190
Other Decks in Technology
See All in Technology
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
170
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
300
メンタル面でもつよつよエンジニアになる/登壇資料(井田 献一朗)
hacobu
0
120
3年でバックエンドエンジニアが5倍に増えても破綻しなかったアーキテクチャ そして、これから / Software architecture that scales even with a 5x increase in backend engineers in 3 years
euglena1215
9
3.7k
多様なメトリックとシステムの健全性維持
masaaki_k
0
120
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
18
5.6k
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
280
効率的な技術組織が作れる!書籍『チームトポロジー』要点まとめ
iwamot
2
120
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
200
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
140
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
160
pg_bigmをRustで実装する(第50回PostgreSQLアンカンファレンス@オンライン 発表資料)
shinyakato_
0
120
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
The Cost Of JavaScript in 2023
addyosmani
46
7k
Making the Leap to Tech Lead
cromwellryan
133
9k
Producing Creativity
orderedlist
PRO
342
39k
For a Future-Friendly Web
brad_frost
175
9.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
GraphQLとの向き合い方2022年版
quramy
44
13k
KATA
mclloyd
29
14k
A Tale of Four Properties
chriscoyier
157
23k
Being A Developer After 40
akosma
87
590k
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