Skip to content

Commit b97c349

Browse files
committed
NotificationManager: droiddoc documentation improvements
Specifically, corrects and improves the overview and the documentation for the NotificationManager.notify(String, int, Notification) method to reflect the fact that the pair (tag, id) is used for notification matching. Change-Id: Ic088a56f457285523d90d296853685393b8c3412
1 parent fdb39fe commit b97c349

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

core/java/android/app/NotificationManager.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,17 @@
3838
* </ul>
3939
*
4040
* <p>
41-
* Each of the notify methods takes an int id parameter. This id identifies
42-
* this notification from your app to the system, so that id should be unique
43-
* within your app. If you call one of the notify methods with an id that is
44-
* currently active and a new set of notification parameters, it will be
45-
* updated. For example, if you pass a new status bar icon, the old icon in
46-
* the status bar will be replaced with the new one. This is also the same
47-
* id you pass to the {@link #cancel} method to clear this notification.
41+
* Each of the notify methods takes an int id parameter and optionally a
42+
* {@link String} tag parameter, which may be {@code null}. These parameters
43+
* are used to form a pair (tag, id), or ({@code null}, id) if tag is
44+
* unspecified. This pair identifies this notification from your app to the
45+
* system, so that pair should be unique within your app. If you call one
46+
* of the notify methods with a (tag, id) pair that is currently active and
47+
* a new set of notification parameters, it will be updated. For example,
48+
* if you pass a new status bar icon, the old icon in the status bar will
49+
* be replaced with the new one. This is also the same tag and id you pass
50+
* to the {@link #cancel(int)} or {@link #cancel(String, int)} method to clear
51+
* this notification.
4852
*
4953
* <p>
5054
* You do not instantiate this class directly; instead, retrieve it through
@@ -93,12 +97,11 @@ public void notify(int id, Notification notification)
9397
/**
9498
* Persistent notification on the status bar,
9599
*
96-
* @param tag An string identifier for this notification unique within your
97-
* application.
100+
* @param tag A string identifier for this notification. May be {@code null}.
101+
* @param id An identifier for this notification. The pair (tag, id) must be unique
102+
* within your application.
98103
* @param notification A {@link Notification} object describing how to
99104
* notify the user, other than the view you're providing. Must not be null.
100-
* @return the id of the notification that is associated with the string identifier that
101-
* can be used to cancel the notification
102105
*/
103106
public void notify(String tag, int id, Notification notification)
104107
{

0 commit comments

Comments
 (0)