Skip to content

Most visited

Recently visited

navigation
Added in API level 18

StatusBarNotification

public class StatusBarNotification
extends Object implements Parcelable

java.lang.Object
   ↳ android.service.notification.StatusBarNotification


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

Summary

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<StatusBarNotification> CREATOR

Public constructors

StatusBarNotification(String pkg, String opPkg, 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.

String getGroupKey()

A key that indicates the group with which this message ranks.

int getId()

The id supplied to notify(int, Notification).

String getKey()

A unique instance key for this notification record.

Notification getNotification()

The Notification supplied to notify(int, Notification).

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.

UserHandle getUser()

The UserHandle for whom this notification is intended.

int getUserId()

This method was deprecated in API level 21. Use getUser() instead.

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.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Fields

CREATOR

Added in API level 18
Creator<StatusBarNotification> CREATOR

Public constructors

StatusBarNotification

Added in API level 18
StatusBarNotification (String pkg, 
                String opPkg, 
                int id, 
                String tag, 
                int uid, 
                int initialPid, 
                int score, 
                Notification notification, 
                UserHandle user, 
                long postTime)

Parameters
pkg String
opPkg String
id int
tag String
uid int
initialPid int
score int
notification Notification
user UserHandle
postTime long

StatusBarNotification

Added in API level 18
StatusBarNotification (Parcel in)

Parameters
in Parcel

Public methods

clone

Added in API level 18
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
StatusBarNotification a copy of this object.

describeContents

Added in API level 18
int describeContents ()

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

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

getGroupKey

Added in API level 21
String getGroupKey ()

A key that indicates the group with which this message ranks.

Returns
String

getId

Added in API level 18
int getId ()

The id supplied to notify(int, Notification).

Returns
int

getKey

Added in API level 20
String getKey ()

A unique instance key for this notification record.

Returns
String

getNotification

Added in API level 18
Notification getNotification ()

The Notification supplied to notify(int, Notification).

Returns
Notification

getPackageName

Added in API level 18
String getPackageName ()

The package of the app that posted the notification.

Returns
String

getPostTime

Added in API level 18
long getPostTime ()

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

Returns
long

getTag

Added in API level 18
String getTag ()

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

Returns
String

getUser

Added in API level 21
UserHandle getUser ()

The UserHandle for whom this notification is intended.

Returns
UserHandle

getUserId

Added in API level 18
int getUserId ()

This method was deprecated in API level 21.
Use getUser() instead.

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

Returns
int

isClearable

Added in API level 18
boolean isClearable ()

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

Returns
boolean

isOngoing

Added in API level 18
boolean isOngoing ()

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

Returns
boolean

toString

Added in API level 18
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
String a printable representation of this object.

writeToParcel

Added in API level 18
void writeToParcel (Parcel out, 
                int flags)

Flatten this object in to a Parcel.

Parameters
out Parcel: The Parcel in which the object should be written.
flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.