Slide 1

Slide 1 text

Shibuya.apk #34 in 2019/05/17 Bubbles

Slide 2

Slide 2 text

About me 志甫 侑紀 / YUKI SHIHO @shihochan Software Engineer at AbemaTV, Inc. @shihochandesu Shibuya.apk Cat LOVER KEYAKIZAKA 46

Slide 3

Slide 3 text

• Bubbles • Live Coding • Tips Agenda

Slide 4

Slide 4 text

• The platform alternative to SAW • SYSTEM_ALERT_WINDOW is fully deprecated • Bubbles is new in Q Bubbles

Slide 5

Slide 5 text

Anatomy of a Bubble

Slide 6

Slide 6 text

1.Configure the activity shown in the bubble 2.Construct BubbleMetadata and add it to your notification 3.Send that notification Build Bubbles

Slide 7

Slide 7 text

1.Configure the activity in AndroidManifest.xml AndroidManifest.xml

Slide 8

Slide 8 text

// Create bubble intent val target = Intent(context, BubbleActivity::class.java) val bubbleIntent = PendingIntent.getActivity(context, 0, target, 0) // Create bubble metadata val bubbleMetadata = Notification.BubbleMetadata.Builder() .setDesiredHeight(600) .setIcon(Icon.createWithResource(context, R.mipmap.ic_launcher_roun .setIntent(bubbleIntent) .build() 2.Construct BubbleMetadata

Slide 9

Slide 9 text

val builder = Notification.Builder(context, CHANNEL_ID) .setContentIntent(pendingIntent) .setContentTitle(notificationTitle) .setSmallIcon(R.mipmap.ic_launcher_round) .setBubbleMetadata(bubbleMetadata) notificationManager.notify(id, builder.build()) 2.Add BubbleMetadata to notification

Slide 10

Slide 10 text

Live Coding

Slide 11

Slide 11 text

Tips

Slide 12

Slide 12 text

Tips • The first time you send the notification, it has to be in a notification channel with IMPORTANCE_HIGH. • Only send if it is important enough such as ongoing communications, or if the user has explicitly requested a bubble for some content. • the bubble can be disabled by the user. In that case, a bubble notification is shown as a normal notification.

Slide 13

Slide 13 text

Shibuya.apk #34 in 2019/05/17 Thanks