Android Wear

Android Wear

Charla de Android Wear impartida en la ETSIIT de la UGR.

Esteban Dorado Roldan

December 04, 2014

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

46 slides
  1. ¿Quien soy? Esteban GDG Granada Organizer #devfestGRX GDG Granada GDG

    Granada Organizer Android Dev Web Dev @Mr_Esti
  2. #androidwear Android Wear • Android 4.4W • SDK level 20

    • android.webkit • android.print • android.app.backup • android.appwidget • android.hardware.usb
  3. #androidwear Notificación // add a action to show on Phone

    and Wearable notificationBuilder = .addAction(iconRes, "ActionTitle", pendingIntentAction1); // show the notification notificationManager.notify(notificationId, notificationBuilder.build()); // create notification using a builder NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setContentTitle("Title") .setContentText("Short message") .setContextnIntent(pendingIntent) ...;
  4. #androidwear Notificación (ajuste para Wearable) // add the Wearable Action

    to the notification notificationBuilder.extend(wearableAction); // show the notification just on the Phone notificationBuilder.setLocalOnly(true); // create the Wearable action NotificationCompat.Action wearableAction = new NotificationCompat.Action.Builder(iconRes, "WearableActionTitle", pendingIntentAction2)) .build();
  5. #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
  6. #androidwear Notificación - Pages // Create second page notification Notification

    secondPageNotification = new NotificationCompat.Builder(this) .setContentText("2nd Page Context")... .build(); // Wrap second page in WearableExtender and extend // the main notification Notification twoPagesNotification = new WearableExtender() .addPage(secondPageNotification) .extend(notificationBuilder) .build(); notificationManager.notify(notificationId, twoPagesNotification);
  7. #androidwear Notificación - Stack // Create second page notification final

    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”
  8. #androidwear Notificación - Actions en VoiceInput // Create intent for

    reply action Intent 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 intent private 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();
  9. #androidwear Notificación - Actions en VoiceInput // 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) ... .extend(new WearableExtender().addAction(action)) .build();
  10. #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
  11. 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
  12. Recursos • Workshop Android Wear http://www.slideshare.net/nescafemix/presentacion- codemotion-workshopandroidwear • Sensor Dashboard

    App https://github.com/pocmo/SensorDashboard • GDGMallorca Wear https://github.com/GDGMallorca/GDGMallorcaWear • Jorge Barroso (Karumi) http://vimeo.com/110121100 • Google Android Wear DevFest http://decharlas.uji.es/ #androidwear

More Decks by Esteban Dorado Roldan

Other Decks in Programming