Slide 34
Slide 34 text
Notifications
PendingIntent openListPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this,
GroceryListActivity.class), 0);
NotificationCompat.Action action = new NotificationCompat.Action.Builder(
R.drawable.ic_action_reload, "Reload", openListPendingIntent)
.build();
Notification notif = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("WearDemo")
.setContentText("List Updated")
.setContentIntent(openListPendingIntent)
.setAutoCancel(true)
.extend(new android.support.v4.app.NotificationCompat.WearableExtender().addAction(action))
.build();
NotificationManagerCompat mgr = NotificationManagerCompat.from(this);
mgr.notify(NOTIFICATION_ID, notif);