Added in API level 18

StatusBarNotification


open class StatusBarNotification : Parcelable
kotlin.Any
   ↳ android.service.notification.StatusBarNotification

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

Summary

Inherited constants
Public constructors
StatusBarNotification(pkg: String!, opPkg: String!, id: Int, tag: String!, uid: Int, initialPid: Int, score: Int, notification: Notification!, user: UserHandle!, postTime: Long)

Public methods
open StatusBarNotification!

open Int

open String!

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

open Int

The id supplied to android.app.NotificationManager#notify(int, Notification).

open String!

A unique instance key for this notification record.

open Notification!

The android.app.Notification supplied to android.app.NotificationManager#notify(int, Notification).

open String

The package that posted the notification.

open String!

Returns the override group key.

open String!

The package that the notification belongs to.

open Long

The time (in System#currentTimeMillis time) the notification was posted, which may be different than android.app.Notification#when.

open String!

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

open Int

The notifying app's (getPackageName()'s) uid.

open UserHandle!

The android.os.UserHandle for whom this notification is intended.

open Int

Returns a userid for whom this notification is intended.

open Boolean

Returns true if application asked that this notification be part of a group.

open Boolean

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

open Boolean

Returns true if this notification is part of a group.

open Boolean

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

open Unit
setOverrideGroupKey(overrideGroupKey: String!)

Sets the override group key.

open String

open Unit
writeToParcel(out: Parcel, flags: Int)

Properties
static Parcelable.Creator<StatusBarNotification!>

Public constructors

StatusBarNotification

Added in API level 18
StatusBarNotification(
    pkg: String!,
    opPkg: String!,
    id: Int,
    tag: String!,
    uid: Int,
    initialPid: Int,
    score: Int,
    notification: Notification!,
    user: UserHandle!,
    postTime: Long)

Deprecated: Non-system apps should not need to create StatusBarNotifications.

StatusBarNotification

Added in API level 18
StatusBarNotification(in: Parcel!)

Public methods

clone

Added in API level 18
open fun clone(): StatusBarNotification!
Return
StatusBarNotification! a clone of this instance.
Exceptions
java.lang.CloneNotSupportedException if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

describeContents

Added in API level 18
open fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getGroupKey

Added in API level 21
open fun getGroupKey(): String!

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

getId

Added in API level 18
open fun getId(): Int

The id supplied to android.app.NotificationManager#notify(int, Notification).

getKey

Added in API level 20
open fun getKey(): String!

A unique instance key for this notification record.

getNotification

Added in API level 18
open fun getNotification(): Notification!

The android.app.Notification supplied to android.app.NotificationManager#notify(int, Notification).

getOpPkg

Added in API level 29
open fun getOpPkg(): String

The package that posted the notification.

Might be different from getPackageName() if the app owning the notification has a notification delegate.

Return
String This value cannot be null.

getOverrideGroupKey

Added in API level 24
open fun getOverrideGroupKey(): String!

Returns the override group key.

getPackageName

Added in API level 18
open fun getPackageName(): String!

The package that the notification belongs to.

getPostTime

Added in API level 18
open fun getPostTime(): Long

The time (in System#currentTimeMillis time) the notification was posted, which may be different than android.app.Notification#when.

getTag

Added in API level 18
open fun getTag(): String!

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

getUid

Added in API level 29
open fun getUid(): Int

The notifying app's (getPackageName()'s) uid.

getUser

Added in API level 21
open fun getUser(): UserHandle!

The android.os.UserHandle for whom this notification is intended.

getUserId

Added in API level 18
Deprecated in API level 21
open fun getUserId(): Int

Deprecated: Use getUser() instead.

Returns a userid for whom this notification is intended.

isAppGroup

Added in API level 30
open fun isAppGroup(): Boolean

Returns true if application asked that this notification be part of a group.

isClearable

Added in API level 18
open fun isClearable(): Boolean

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

isGroup

Added in API level 24
open fun isGroup(): Boolean

Returns true if this notification is part of a group.

isOngoing

Added in API level 18
open fun isOngoing(): Boolean

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

setOverrideGroupKey

Added in API level 24
open fun setOverrideGroupKey(overrideGroupKey: String!): Unit

Sets the override group key.

toString

Added in API level 18
open fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 18
open fun writeToParcel(
    out: Parcel,
    flags: Int
): Unit
Parameters
dest The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 18
static val CREATOR: Parcelable.Creator<StatusBarNotification!>