Notifying the User

Your worker is now running and checking for new photos in the background, but the user does not know anything about it. When PhotoGallery finds new photos the user has not seen yet, it should prompt the user to open the app and see the new content.

When your app 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 down from the top of the screen.

Before you can create notifications on Android devices running Android Oreo (API level 26) and higher, you must create a Channel. A Channel categorizes notifications and gives the user fine-grained control over notification preferences. ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.