According to the "Design for Notifications" document, notifications can (and should) include a category when they are created. Categories include things like calls, messages, promotions, progress notifications, system messages, and social updates.
In addition to enumerating the categories, actual system library constants are listed on the page, like Notification.CATEGORY_CALL
, Notification.CATEGORY_PROGRESS
, and Notification.CATEGORY_SOCIAL
.
However, these constants, and the whole category system, seems only to be mentioned in the "Design for Notifications" page. At this writing, the API documentation for Notification doesn't include those constants, and there doesn't seem to be any method like setCategory
documented in Notification.Builder
. A Google search for "Notification.CATEGORY_PROGRESS" turns up only the "Design for Notifications" document.
Does anybody out there know how to actually use these categories, and assign them to your notifications in L preview?
EDIT:
A peek at the current Notification source code in the current aosp/preview-l branch shows no evidence of the constants. Could this be a feature that didn't make the cut for the release? (If so, is there anybody out there who might be able to confirm that?)
For reference:
"Design for Notifications" : https://developer.android.com/preview/notifications.html#set_a_notification_category
That Google search that turns up nothing : https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=%22Notification.CATEGORY_PROGRESS%22
EDIT:
A-C's answer below seems to indicate that categories will be in the release but not the preview (although they might indicate the features were removed from the release). The constants and appropriate builder interface are documented in them.
EDIT:
The category constants and setCategory
method were included in the API 21/Lollipop release. They're not all that well documented but they are present.
The L Developer Preview Documentation contains the constants as well as a setCategory()
method in the both regular and compatibility Builder
classes.
Thus, the category is set manually.
However, as you have noticed the l-preview
source doesn't include them.
Without an actual Android team member to answer your question, I'd conclude that it will be a feature in the final release, but won't actually be available in the preview unless they plan on making multiple preview releases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With