The Jimdo Mobile team at lunch...

Use technologie but get it out of the way!

Android Wear

The Context Stream

  • list of cards
  • vertical navigation
  • horizontal interaction
  • Google Now
  • Notifications (Your Apps!!!)
  • Stacks, Pages, Actions

The "Launcher"

  • activation by "OK Google"
    or tapping the watchface
  • Voice Actions
  • shows list of suggested Actions
  • f.e. "Take a note"
  • each Action triggers an Intent
  • apps can react to Intents just as usual
    using IntentFilters
  • Explicit Intents, f.e. "OK Google Start AppXY"
  • Implicit Intents, f.e. "OK Google Take a Note"

Android Wear

  • Android 4.4W
  • SDK lvl 20
  • android.webkit
  • android.print
  • android.app.backup
  • android.appwidget
  • android.hardware.usb
      PackageManager pm = context.getPackageManager();
      if (pm.hasSystemFeature(PackageManager.FEATURE_WIFI)) {
        ...
      }

Android Wear App

  • provides access to all the notifications
  • Android 4.3
  • Google Play Services 5.0 (Wearable Services)
  • syncs wearable apps to the watch
  • reads notifications and pushes them
    to the wearable device
  • define default apps for intents
  • do watch settings

Needed dependencies

  • com.android.support:support-v4:20.+
    • provides APIs to adjust Notifications for Wearables
  • com.google.android.gms:play-services:5.0.77
    • provides Wearable Service APIs to sync data between the Phone and the Wearable
    • seperately available as: com.google.android.gms:play-services-wearable:+
  • com.google.android.support:wearable:+
    • provides Layouts and Views to use on Wearables, like...
      • CardFragment
      • CircledImageView
      • GridViewPager
      • WearableListView

Notifications (just as usual)

// create notification using a builder
NotificationCompat.Builder notificationBuilder =
        new NotificationCompat.Builder(this)
        .setContentTitle("Title")
        .setContentText("Short message")
        .setContextnIntent(pendingIntent) ...;
    
// add a action to show on Phone and Wearable
notificationBuilder =
        .addAction(iconRes, "ActionTitle", pendingIntentAction1);
    
// show the notification
notificationManager.notify(notificationId, notificationBuilder.build());  
    

... with adjustments for Wearables

// create the Wearable action
NotificationCompat.Action wearableAction =
        new NotificationCompat.Action.Builder(iconRes,
                "WearableActionTitle", pendingIntentAction2))
                .build();
    
// add the Wearable Action to the notification
notificationBuilder.extend(wearableAction);
    
// show the notification just on the Phone
notificationBuilder.setLocalOnly(true);  
    

Notification - 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);
    

Notification - Stacks

Notification - Actions with 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();
    

Notification - Actions with 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();

    

Sending and Syncing Data

  • Data Items
    • Data storage with automatic synching between Phone and Wearable
  • Messages
    • "Fire-&-Forget" commands
    • deliver Intents or MediaPlayer commands
  • Assets
    • send binary blobs of data (f.e. images)
    • automatic caching to avoid repeating transfers over bluetooth

Available Devices

Motorola Moto360

Wear Camera Remote: "OK Google Start Camera"

Google Keep: "OK Google Take a Note"

Google Music

d.android.com/wear

<Thanx!>