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
27
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
23
TensorFlow no Android
douglasdrumond
0
17
Firebase or Realm?
douglasdrumond
0
74
Rio Dev Day – Introdução ao Android
douglasdrumond
0
92
Google I/O
douglasdrumond
0
56
Criando apps com alto nível de qualidade (versão longa)
douglasdrumond
0
36
Criando apps com alto nível de qualidade (versão curta)
douglasdrumond
0
24
Primeiros Passos com Google Fit
douglasdrumond
0
180
Other Decks in Technology
See All in Technology
匠MethodとRDRAとICONIXとDDDで実現する一気通貫オブジェクト指向開発
haru860
4
1.5k
「XX試験の環境作ってよ」と言われた時によく使うAWSのソリューションについて
bun913
0
120
TCA入門したてなので、自分が馴染みのある実装と比較しながらキャッチアップしてみる
fumiyasac0921
1
370
エンジニア候補者向け資料2024.03.28.pdf
macloud
0
2.9k
Challenges - Open Farming Hackdays 2024
loleg
0
490
AWS アーキテクチャクイズ
yuu26
2
700
.NETの非同期戦略とUnityとの相互運用
neuecc
2
2.4k
GitHub最新情報キャッチアップ 2024年3月
dzeyelid
16
3.1k
なんで私に登壇依頼が?! ~頼られるエンジニアになるためには~ /
mixi_engineers
PRO
2
200
プッシュ型子育てサービスを、先行プロジェクト実施自治体において開始します
govtechtokyo
0
220
複数の LLM モデルを扱う上で直面した辛みまとめ
kazuyaseki
1
210
8週連続ウェビナー_イチから学ぶFivetran
cmsuzu
0
160
Featured
See All Featured
Done Done
chrislema
178
15k
The World Runs on Bad Software
bkeepers
PRO
60
6.6k
How to name files
jennybc
62
92k
Fantastic passwords and where to find them - at NoRuKo
philnash
35
2.4k
Into the Great Unknown - MozCon
thekraken
10
830
Designing on Purpose - Digital PM Summit 2013
jponch
109
6.4k
WebSockets: Embracing the real-time Web
robhawkes
59
6.9k
Faster Mobile Websites
deanohume
296
30k
The Illustrated Children's Guide to Kubernetes
chrisshort
28
46k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
11
1.4k
The MySQL Ecosystem @ GitHub 2015
samlambert
242
12k
Designing for Performance
lara
601
67k
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