Slide 1

Slide 1 text

Android Notification Channels: The Complicated Parts Dan Lew

Slide 2

Slide 2 text

Goal • Inform users • …Without annoying them

Slide 3

Slide 3 text

Noises • Sound
 
 
 


Slide 4

Slide 4 text

Noises • Sound • Vibration
 


Slide 5

Slide 5 text

Noises • Sound • Vibration • Light

Slide 6

Slide 6 text

Noises v2 • Metadata • Priority • Categories • People • Do not Disturb interruptions • Hiding on lock screen

Slide 7

Slide 7 text

Android Oreo • Notification badges on launcher • Channels

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Channels give users control

Slide 10

Slide 10 text

User Control App Control Importance Sound Vibration Light Show on lock screen Show badges on launcher Bypass "Do Not Disturb” Channel Name Channel Description

Slide 11

Slide 11 text

targetSdkVersion 26 == Channels

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Measure Twice, Cut Once

Slide 14

Slide 14 text

How Many Channels?

Slide 15

Slide 15 text

Trello Channel Overview Important Minor Temporary Mentions New Cards Attachments Due Soon Cards Boards Comments Memberships

Slide 16

Slide 16 text

Notification Groups

Slide 17

Slide 17 text

Importance IMPORTANCE_HIGH Make sound and pop on screen IMPORTANCE_DEFAULT Make sound IMPORTANCE_LOW No sound IMPORTANCE_NONE No sound or visual interruption

Slide 18

Slide 18 text

Custom Noise • Sound • Vibration • Light

Slide 19

Slide 19 text

Bells and Whistles • Badges on launcher • Bypass “do not disturb”

Slide 20

Slide 20 text

Playing Dirty • Can delete & recreate channels • Users will know • Will annoy users

Slide 21

Slide 21 text

val channel = NotificationChannel("news", “News", NotificationManager.IMPORTANCE_DEFAULT)
 channel.description = "News and weather"
 channel.setShowBadge(false)
 
 val manager = context.getSystemService(NotificationManager::class.java)
 manager.createNotificationChannel(channel)

Slide 22

Slide 22 text

val channel = NotificationChannel("news", “News", NotificationManager.IMPORTANCE_DEFAULT)
 channel.description = "News and weather"
 channel.setShowBadge(false)
 
 val manager = context.getSystemService(NotificationManager::class.java)
 manager.createNotificationChannel(channel)

Slide 23

Slide 23 text

val notification = NotificationCompat.Builder(context, "news")
 .setThis() .setThat()
 .etc()
 .build()

Slide 24

Slide 24 text

Timing • Create channels at… • Startup • First notification • Create all channels at once • Channel creation is idempotent

Slide 25

Slide 25 text

Inform users… ...WITHOUT annoying them

Slide 26

Slide 26 text

How to annoy users without really trying

Slide 27

Slide 27 text

Too Many Sounds

Slide 28

Slide 28 text

Too Many Rows

Slide 29

Slide 29 text

Notification Bundles 1-3 notifications 4+ notifications

Slide 30

Slide 30 text

Notification Bundles Pros Cons Easy Works across channels Many noises Only on Nougat+

Slide 31

Slide 31 text

Notification Groups 1 notification 2+ notifications

Slide 32

Slide 32 text

Notification Groups

Slide 33

Slide 33 text

Notification Groups Pros Cons Few notifications Few noises Extra work

Slide 34

Slide 34 text

Notification Groups val summaryNotification = NotificationCompat.Builder(context, "news")
 ...
 .setGroupSummary(true)
 .setGroup("myGroup")
 .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY)
 .build()
 
 val childNotification = NotificationCompat.Builder(context, "news")
 ...
 .setGroupSummary(false)
 .setGroup("myGroup")
 .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY)
 .build()

Slide 35

Slide 35 text

Channels Break Groups • One group fails when channel disabled • Group-per-channel creates too many rows • Group-per-channel creates too many noises

Slide 36

Slide 36 text

Channel Dilemma Bundling Groups Fewer rows Many noises Many rows Fewer noises

Slide 37

Slide 37 text

Channel Solution • Channel should either… • Have a group summary • Be IMPORTANCE_LOW or lower

Slide 38

Slide 38 text

Trello’s Setup Name Importance Summary Launcher Badge? Mentions HIGH Yes Yes Due Soon DEFAULT Yes Yes Boards LOW No Yes Cards LOW No Yes Comments LOW No Yes Memberships LOW No Yes New Cards LOW No Yes Attachments MIN No No

Slide 39

Slide 39 text

Odds and Ends

Slide 40

Slide 40 text

Remove Notification Settings

Slide 41

Slide 41 text

Remove Notification Settings Intent

Slide 42

Slide 42 text

Listen to ACTION_LOCALE_CHANGED

Slide 43

Slide 43 text

Use setAlertOnlyOnce()

Slide 44

Slide 44 text

Summary • Embrace channels • Choose good defaults • Don’t annoy users

Slide 45

Slide 45 text

Thank You! • danlew.net • @danlew42