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
39
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
33
BLE
douglasdrumond
0
31
TensorFlow no Android
douglasdrumond
0
24
Firebase or Realm?
douglasdrumond
0
80
Rio Dev Day – Introdução ao Android
douglasdrumond
0
99
Google I/O
douglasdrumond
0
62
Criando apps com alto nível de qualidade (versão longa)
douglasdrumond
0
41
Criando apps com alto nível de qualidade (versão curta)
douglasdrumond
0
28
Primeiros Passos com Google Fit
douglasdrumond
0
190
Other Decks in Technology
See All in Technology
監視のこれまでとこれから/sakura monitoring seminar 2025
fujiwara3
10
2.9k
OpenHands🤲にContributeしてみた
kotauchisunsun
0
280
AWS CDK 実践的アプローチ N選 / aws-cdk-practical-approaches
gotok365
4
550
Witchcraft for Memory
pocke
1
110
JSX - 歴史を振り返り、⾯⽩がって、エモくなろう
pal4de
4
1.1k
~宇宙最速~2025年AWS Summit レポート
satodesu
1
1.5k
データプラットフォーム技術におけるメダリオンアーキテクチャという考え方/DataPlatformWithMedallionArchitecture
smdmts
5
580
実践! AIエージェント導入記
1mono2prod
0
150
OAuth/OpenID Connectで実現するMCPのセキュアなアクセス管理
kuralab
5
890
米国国防総省のDevSecOpsライフサイクルをAWSのセキュリティサービスとOSSで実現
syoshie
2
840
AWS Summit Japan 2025 Community Stage - App workflow automation by AWS Step Functions
matsuihidetoshi
1
150
PHP開発者のためのSOLID原則再入門 #phpcon / PHP Conference Japan 2025
shogogg
2
460
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
329
21k
Documentation Writing (for coders)
carmenintech
71
4.9k
Side Projects
sachag
455
42k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
Making Projects Easy
brettharned
116
6.3k
Thoughts on Productivity
jonyablonski
69
4.7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
VelocityConf: Rendering Performance Case Studies
addyosmani
330
24k
Practical Orchestrator
shlominoach
188
11k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
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