Android Notification Channels: The Complicated Parts

D225ebf0faa666ac7655cc7e4689283c?s=47 Daniel Lew
September 05, 2017

Android Notification Channels: The Complicated Parts

Talk given to GDG Twin Cities.

D225ebf0faa666ac7655cc7e4689283c?s=128

Daniel Lew

September 05, 2017
Tweet

Transcript

  1. 6.

    Noises v2 • Metadata • Priority • Categories • People

    • Do not Disturb interruptions • Hiding on lock screen
  2. 8.
  3. 10.

    User Control App Control Importance Sound Vibration Light Show on

    lock screen Show badges on launcher Bypass "Do Not Disturb” Channel Name Channel Description
  4. 12.
  5. 17.

    Importance IMPORTANCE_HIGH Make sound and pop on screen IMPORTANCE_DEFAULT Make

    sound IMPORTANCE_LOW No sound IMPORTANCE_NONE No sound or visual interruption
  6. 21.

    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)
  7. 22.

    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)
  8. 24.

    Timing • Create channels at… • Startup • First notification

    • Create all channels at once • Channel creation is idempotent
  9. 34.

    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()
  10. 35.

    Channels Break Groups • One group fails when channel disabled

    • Group-per-channel creates too many rows • Group-per-channel creates too many noises
  11. 37.
  12. 38.

    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