Android Programming: The Big Nerd Ranch Guide, 2nd Edition
by Bill Phillips, Chris Stewart, Brian Hardy, Kristin Marsicano
Notifications
Your service is now running and doing its thing in the background. But the user never knows a thing about it, so it is not worth much.
When your service needs to communicate something to the user, the proper tool is almost always a notification. Notifications are items that appear in the notifications drawer, which the user can access by dragging it down from the top of the screen.
To post a notification, you first need to create a Notification object. Notifications are created by using a builder object, much like AlertDialog was in Chapter 12. At a minimum, your Notification should have:
-
ticker text to display in the status bar when the notification is first shown on pre-Lollipop devices (starting with Android ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access