Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

StatusBarNotification

extends Object
implements Parcelable
java.lang.Object
   ↳ android.service.notification.StatusBarNotification

Class Overview

Class encapsulating a Notification. Sent by the NotificationManagerService to clients including the status bar and any NotificationListenerService s.

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator < StatusBarNotification > CREATOR
Public Constructors
StatusBarNotification ( String pkg, String basePkg, int id, String tag, int uid, int initialPid, int score, Notification notification, UserHandle user, long postTime)
StatusBarNotification ( Parcel in)
Public Methods
StatusBarNotification clone ()
Creates and returns a copy of this Object .
int describeContents ()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
int getId ()
The id supplied to notify(int, Notification) .
String getKey ()
A unique instance key for this notification record.
Notification getNotification ()
String getPackageName ()
The package of the app that posted the notification.
long getPostTime ()
The time (in currentTimeMillis() time) the notification was posted, which may be different than when .
String getTag ()
The tag supplied to notify(int, Notification) , or null if no tag was specified.
int getUserId ()
Returns a userHandle for the instance of the app that posted this notification.
boolean isClearable ()
Convenience method to check the notification's flags for either FLAG_ONGOING_EVENT or FLAG_NO_CLEAR .
boolean isOngoing ()
Convenience method to check the notification's flags for FLAG_ONGOING_EVENT .
String toString ()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel ( Parcel out, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator < StatusBarNotification > CREATOR

Public Constructors

public StatusBarNotification ( String pkg, String basePkg, int id, String tag, int uid, int initialPid, int score, Notification notification, UserHandle user, long postTime)

public StatusBarNotification ( Parcel in)

Public Methods

public StatusBarNotification clone ()

Creates and returns a copy of this Object . The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should call super.clone() to create the new instance and then create deep copies of the nested, mutable objects.

Returns
  • a copy of this object.

public int describeContents ()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public int getId ()

The id supplied to notify(int, Notification) .

public String getKey ()

A unique instance key for this notification record.

public Notification getNotification ()

public String getPackageName ()

The package of the app that posted the notification.

public long getPostTime ()

The time (in currentTimeMillis() time) the notification was posted, which may be different than when .

public String getTag ()

The tag supplied to notify(int, Notification) , or null if no tag was specified.

public int getUserId ()

Returns a userHandle for the instance of the app that posted this notification.

public boolean isClearable ()

Convenience method to check the notification's flags for either FLAG_ONGOING_EVENT or FLAG_NO_CLEAR .

public boolean isOngoing ()

Convenience method to check the notification's flags for FLAG_ONGOING_EVENT .

public String toString ()

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

          getClass().getName() + '@' + Integer.toHexString(hashCode())
         

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

public void writeToParcel ( Parcel out, int flags)

Flatten this object in to a Parcel.

Parameters
out The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE .