Upload
jm-robles
View
153
Download
4
Tags:
Embed Size (px)
DESCRIPTION
Esteban Dorado y Michelle de GDG Granada hacen una introducción a Android Wear y enseñan cómo se programa.
Citation preview
Android Wear
#androidwear
Esteban GDG Granada Organizer
Michaëlle GDG Granada Organizer
¿Quiénes somos?
@Mr_Esti @Eudaric
#androidwear
#androidwear
#androidwear
#androidwear
#androidwear
#androidwear
Android Wear
#androidwear
● Lista de tarjetas● Navegación Vertical● Interacción horizontal● Google Now● Notificaciones (Tus Apps!!!)● Stacks, Pages, Actions
Android Wear
#androidwear
“Launcher”
● Activación por “OK Google” o tocando la pantalla
● Acciones por voz● Muestra una lista de acciones
sugeridas● Por ejemplo: “Apuntar Nota”● Explicito: "OK Google Start AppXY”● Implicito: “OK Google Take a Note”
#androidwear
Android Wear● Android 4.4W● SDK level 20
● android.webkit● android.print● android.app.backup● android.appwidget● android.hardware.usb
#androidwear
Android Wear App● Acceso a todas las notificaciones● +Android 4.3● Google Play Services 5.0 (Wearable Services)● Sincroniza app wearables al reloj● Lee las notificaciones y las envía al dispositivo
wearable● Define las apps por defecto para las intenciones● Configuración del reloj
#androidwear
Dependencias● com.android.support:support-v4:20.+
○ APIs para ajustar Notificaciones para Wearables.● com.google.android.gms:play-services:5.0.77+
○ API Wearable Service para sincronizar datos entre el Telefono y el Wearable
○ Disponible: com.google.android.gms:play-services-wearable:+● com.google.android.support:wearable:+
○ Layouts y Views para usar en Wearables como:■ CardFragment■ CircledImageView■ GridViewPager■ WearableListView
Notificationes Apps
#androidwear
#androidwear
● La parte fácil
Notificaciones
RepliesPagesStacks
#androidwear
La parte nueva● NotificationCompat
Notificaciones
#androidwear
Notificación
// add a action to show on Phone and WearablenotificationBuilder = .addAction(iconRes, "ActionTitle", pendingIntentAction1);
// show the notificationnotificationManager.notify(notificationId, notificationBuilder.build());
// create notification using a builderNotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setContentTitle("Title") .setContentText("Short message") .setContextnIntent(pendingIntent) ...;
#androidwear
Notificación (ajuste para Wearable)
// add the Wearable Action to the notificationnotificationBuilder.extend(wearableAction);
// show the notification just on the PhonenotificationBuilder.setLocalOnly(true);
// create the Wearable actionNotificationCompat.Action wearableAction = new NotificationCompat.Action.Builder(iconRes, "WearableActionTitle", pendingIntentAction2)) .build();
#androidwear
Notificación (ajuste para Wearable)
// ADD-auto-reply action.addAction(R.drawable.ic_Launcher, context.getString(R.string.notify_people), sendPendingIntent)// Add Custom Reply Action .addAction(replyAction);
● Actions en NotificactionCompat
#androidwear
Notificación - Pages
// Create second page notificationNotification secondPageNotification = new NotificationCompat.Builder(this) .setContentText("2nd Page Context")... .build();
// Wrap second page in WearableExtender and extend// the main notificationNotification twoPagesNotification = new WearableExtender() .addPage(secondPageNotification) .extend(notificationBuilder) .build();
notificationManager.notify(notificationId, twoPagesNotification);
#androidwear
Notificación - Stack
// Create second page notificationfinal static String GROUP_KEY_EMAILS = "group_key_emails"; // Build the notification, setting the group appropriately Notification notif = new NotificationCompat.Builder(mContext) .setContentTitle(”New email from ” + sender1) .setContentText(subject1) .setSmallIcon(R.drawable.new_email) .setGroup(GROUP_KEY_EMAILS) .build();
GoogleConsejo => “Add a Summary Notification”
#androidwear
Notificación - Actions en VoiceInput
// Create intent for reply actionIntent replyIntent = new Intent(this, ReplyActivity.class);PendingIntent replyPendingIntent = PendingIntent.getActivity(this, 0, replyIntent, 0);
// Key for the string that's delivered in the action's intentprivate 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();
#androidwear
Notificación - Actions en VoiceInput
// Create intent for reply actionIntent replyIntent = new Intent(this, ReplyActivity.class);PendingIntent replyPendingIntent = PendingIntent.getActivity(this, 0, replyIntent, 0);
// Key for the string that's delivered in the action's intentprivate 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();
#androidwear
Apps
Send data Custom UI Voice Actions
#androidwear
#androidwear
Node
Data
Message
#androidwear
Data layer
#androidwear
Personalizar Notificaciones
#androidwear
Librería UI para Wearables
#androidwear
● BoxInsetLayout
● Card Fragment
● CircledImageView
● ConfirmationActivity
● DismissOverlayView
● GridViewPager
● GridPagerAdapter
● FragmentGridPagerAdapter
● WatchViewStub
Clases para UIs
#androidwear
<activity android:name="MyNoteActivity"><intent-filter>
<action android:name="android.intent.action.SEND" /><category android:name="com.google.android.voicesearch.SELF_NOTE" />
</intent-filter></activity>
System provided voice action
#androidwear
#androidwear
● Call a car/taxi
● Take a note
● Set alarm
● Set timer
● Start/Stop a bike ride
● Start/Stop a run
● Start/Stop a workout
● Show heart rate
● Show step count
Comandos de voz
<activity android:name="StartRunActivity" android:label="MyRunningApp"><intent-filter>
<action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" />
</intent-filter></activity>
App provided voice action
#androidwear
private void displaySpeechRecognizer() {Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
startActivityForResult(intent, SPEECH_REQUEST_CODE);}
Speech Recognizer
#androidwear
Conclusiones
#androidwear
#androidwear
#androidwear
Simplicity is the ultimate sophistication.Leonardo da Vinci
“
’’#androidwear
#androidwear
#androidwear
Wear Camera Remote: “Ok Google Start Camera”
#androidwear
Google Keep: “Ok Google Take a Note”
Bluetooth Accesories
NewCustom UI
New Voice Actions
#androidwear
GPS Support
Rumores...
#androidwear
d.android.com/wear
#androidwear
¡¡Gracias!!GDG Granadahttp://gdggranada.com/
@gdggranada