notifications for android l & wear

32

Upload: taeho-kim

Post on 15-Jan-2015

421 views

Category:

Education


3 download

DESCRIPTION

2014 GDG 안드로이드 컨퍼런스에서 진행된 'Notifications for Android L & wear' 세션 프리젠테이션입니다.

TRANSCRIPT

Page 1: Notifications for Android L & wear
Page 2: Notifications for Android L & wear
Page 3: Notifications for Android L & wear
Page 4: Notifications for Android L & wear
Page 5: Notifications for Android L & wear
Page 6: Notifications for Android L & wear
Page 7: Notifications for Android L & wear

builder.setContentTitle("Private notification") .setContentText("Private notification content") .setVisibility(Notification.VISIBILITY_PRIVATE) .setColor(Color.argb(1, 204, 0, 0)) .setPublicVersion( new Notification.Builder(this) .setColor(Color.argb(1, 0, 153, 204)) .setSmallIcon(R.drawable.ic_action_web_site) .setContentText("Public version of private content") .setContentTitle("Public version") .build());

Page 8: Notifications for Android L & wear
Page 9: Notifications for Android L & wear
Page 10: Notifications for Android L & wear
Page 11: Notifications for Android L & wear

builder.setPriority(Notification.PRIORITY_HIGH) .setContentTitle("High priority") .setDefaults(Notification.DEFAULT_VIBRATE); mng.notify(1, builder.build());

Page 12: Notifications for Android L & wear

PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(Intent.ACTION_VIEW).setData(Uri.parse("http://android.com")), 0); builder.setFullScreenIntent(pi, true) .setContentIntent(pi) .setContentTitle("Notification with Fullscreen Intent") .setContentText("Content text");

Page 13: Notifications for Android L & wear
Page 14: Notifications for Android L & wear
Page 15: Notifications for Android L & wear
Page 16: Notifications for Android L & wear

Notification notification = new Notification.Builder(BridgeActivity.this) .setSmallIcon(R.drawable.ic_launcher) .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.bg_wear_notes)) .setContentTitle("Android.com") .setContentText("Check out news from android.com!") .setLocalOnly(!cbBridgeNotification.isChecked()) .setAutoCancel(true) .build();

Page 17: Notifications for Android L & wear
Page 18: Notifications for Android L & wear
Page 19: Notifications for Android L & wear
Page 20: Notifications for Android L & wear

// Create wear only action PendingIntent piw = PendingIntent.getActivity(this, 0, new Intent(Intent.ACTION_VIEW).setData(Uri.parse("http://android.com/wear")), PendingIntent.FLAG_UPDATE_CURRENT); Notification.Action wearOnlyAction = new Notification.Action.Builder(R.drawable.ic_action_web_site, "Wear only", piw).build(); ! builder.extend(new Notification.WearableExtender().addAction(wearOnlyAction));

Page 21: Notifications for Android L & wear
Page 22: Notifications for Android L & wear
Page 23: Notifications for Android L & wear
Page 24: Notifications for Android L & wear

remoteInput = new RemoteInput.Builder(VoiceInputResultActivity.KEY_VOICE_INPUT) .setLabel("Say message") .setChoices(getResources().getStringArray(R.array.reply_choices)) .build(); !// 중략 !Notification.Action replyAction = new Notification.Action.Builder(R.drawable.ic_action_web_site, "Reply", pi) .addRemoteInput(remoteInput).build(); !Notification.Builder builder = new Notification.Builder(this) .setSmallIcon(R.drawable.ic_action_web_site) .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.img_gaejugi)) .setAutoCancel(true) .setContentTitle("John Doe") .setContentText("Lunch?") .extend(new Notification.WearableExtender().addAction(replyAction));

Page 25: Notifications for Android L & wear
Page 26: Notifications for Android L & wear

Notification.Builder builder = new Notification.Builder(this); builder.setSmallIcon(R.drawable.ic_action_web_site) //… 생략 !Notification secondPage = new Notification.Builder(this) // 생략 !Notification thirdPage = new Notification.Builder(this) // 생략 !Notification pagingNotification = new Notification.WearableExtender() .addPage(secondPage) .addPage(thirdPage) .extend(builder).build();

Page 27: Notifications for Android L & wear
Page 28: Notifications for Android L & wear
Page 29: Notifications for Android L & wear

Notification noti1 = new Notification.Builder(this).setGroup(GROUP_MESSAGE) // 생략 !Notification noti2 = new Notification.Builder(this).setGroup(GROUP_MESSAGE) // 생략 !NotificationManager mng = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mng.notify(0, noti1); mng.notify(1, noti2); !Notification summary = new Notification.Builder(this) // 생략 .setGroup(GROUP_MESSAGE) .setGroupSummary(true) .extend(new Notification.WearableExtender() .setBackground(BitmapFactory.decodeResource( getResources(), R.drawable.img_gaejugi))) .build(); ! mng.notify(3, summary);

Page 30: Notifications for Android L & wear
Page 31: Notifications for Android L & wear
Page 32: Notifications for Android L & wear