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
77
Rio Dev Day – Introdução ao Android
douglasdrumond
0
95
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
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
640
OS 標準のデザインシステムを超えて - より柔軟な Flutter テーマ管理 | FlutterKaigi 2024
ronnnnn
1
300
Flutterによる 効率的なAndroid・iOS・Webアプリケーション開発の事例
recruitengineers
PRO
0
120
AGIについてChatGPTに聞いてみた
blueb
0
130
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
150
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
130
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
330
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
130
強いチームと開発生産性
onk
PRO
35
12k
DynamoDB でスロットリングが発生したとき_大盛りver/when_throttling_occurs_in_dynamodb_long
emiki
1
440
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
The Rise of LLMOps
asei
9
1.7k
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
380
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Navigating Team Friction
lara
183
14k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Building an army of robots
kneath
302
43k
A better future with KSS
kneath
238
17k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Designing for Performance
lara
604
68k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
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