Notifications

Travis Himes

Intro

  • Travis Himes
  • Developer for approx 12 years
  • Android developer for about 4 or 5
  • Work @ DramaFever, and we're hiring
  • If I get something wrong, tell me!

Notifications

  1. Create an app
  2. Add a button
  3. Add a Click Listener to that button
  4. Click Listener posts a notification...

First Notification

Build the notification and post it

 

  1. Create NotificationBuilder
  2. Build notification
  3. Get Notification Manager
  4. Notify!

Thanks!

We're done here, have a great conference!

Just kidding

this is just the tip of the iceberg... let's go deeper

Make it more interesting

  • Add a PendingIntent
  • Make it go away when tapped
  • Build the back stack when it's followed
  • Add a DeleteIntent
  • Update the notification

Keep in mind

Noitifications can be blocked by the user

Let us expand on what we've learned

  • 4 types of "expandable" notifications
  • Build a BigText
  • Build a BigPicture
  • Build an Inbox
  • Build whatever you want (in a few slides)

Keep in mind

Use the right one for the situation

Take Action!

  • Expandable notifications can have Actions
  • Add some actions to your big notifications
  • How many is too many?

Keep in mind

A LOT

Let us play with...

  • Heads Up Notifications
  • Lock Screen Notifications
  • Notification visibility/privacy
  • Media Playback
  • Progress notification

Pimp my notification

  • Custom notification
  • Custom Big notification

Keep in mind

Use with care, can either put users off, or delight them...

View Heights

64 dp unexpanded

256 dp expanded

UI / Flow summary

  • 3 "routes" out of a notification
  • Consider navigation when building notification destinations
  • Don't harass your users, there are consequences if you do...
  • Give users useful options

Make it even more interesting

  • Set Number
  • Lights, Sound, Vibration!
  • Icons (big vs small)
  • A Heads-Up about Priority
  • Consider the default behavior

Other things to consider

  • Vibrate permission
  • Ongoing notifications
  • Notification's ID
    • Updating notifications
    • Canceling notifications
    • The current state of a notification
  • Keep your icons in line with the style
  • Consider your audience
    • NotificationCompat is awesome
    • Auto-downgrades the notification
    • Make sure users can use the one you build
  • Active Notifications (Moto X, 1st and 2nd gen)
  • Wear

GCM Notifications

  • You mean "push notifications"?

Before we begin

  • Multiple ways to do this...
  • Should use a real device
  • Needs Play Services
  • Old way:
    • curl
  • New way:
    • google gcm example!

Questions?

Thanks!

We're done here, have a great conference!

Seriously this time...

Slides: goo.gl/cPSpRI

Code: goo.gl/BCFNPn

Work with me at DramaFever: 

Notifications

By Travis Himes

Notifications

  • 1,558