to top
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 NotificationListenerServices.

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).
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

Added in API level 18

Public Constructors

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

Added in API level 18

public StatusBarNotification (Parcel in)

Added in API level 18

Public Methods

public StatusBarNotification clone ()

Added in API level 18

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 ()

Added in API level 18

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 ()

Added in API level 18

The id supplied to notify(int, Notification).

public Notification getNotification ()

Added in API level 18

public String getPackageName ()

Added in API level 18

The package of the app that posted the notification.

public long getPostTime ()

Added in API level 18

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

public String getTag ()

Added in API level 18

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

public int getUserId ()

Added in API level 18

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

public boolean isClearable ()

Added in API level 18

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

public boolean isOngoing ()

Added in API level 18

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

public String toString ()

Added in API level 18

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)

Added in API level 18

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.